Skip to content

Commit

Permalink
Merge pull request #1 from itsmng/feat_ci
Browse files Browse the repository at this point in the history
Update CI
  • Loading branch information
Florian Blanchet authored Aug 9, 2024
2 parents 33b505b + f729003 commit 45496ad
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 72 deletions.
38 changes: 21 additions & 17 deletions .github/workflows/generatemo.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,41 @@
name: Generate MO
on:
push:
branches: [ main ]
paths:
- '**.po'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
workflow_dispatch:

jobs:
run:

name: Generate mo
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Setup Perl environment
# You may pin to the exact commit or the version.
# uses: shogo82148/actions-setup-perl@8d2e3d59a9516b785ed32169d48a4888eaa9b514
uses: shogo82148/actions-setup-perl@v1.7.2
- name: msgfmt
# You may pin to the exact commit or the version.
# uses: whtsky/msgfmt-action@6b2181f051b002182d01a1e1f1aff216230c5a4d
uses: whtsky/msgfmt-action@20190305
uses: shogo82148/actions-setup-perl@v1
with:
perl-version: '5.38'

- name: Install dependencies
run: sudo apt install gettext

- name: Generate mo
run: perl tools/update_mo.pl;

- name: Commit changes
uses: EndBug/add-and-commit@v5.1.0
uses: EndBug/add-and-commit@v9
with:

author_name: CI bot
author_email: adminsys@itsm-ng.com
commit: --signoff
default_author: github_actor
message: "Generate mo"

- name: Push changes

uses: actions-go/push@v1
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}


68 changes: 29 additions & 39 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,49 +1,39 @@
name: Release workflow

on:
push:
# Sequence of patterns matched against refs/tags
tags:
- '*.*.*' # Push events to matching ex:20.15.10
- '*'

permissions:
contents: write

name: Create release with tag
env:
TAG_VALUE: ${GITHUB_REF/refs\/tags\//}
jobs:
build:
name: Upload Release Asset
release:
name: Release on GitHub
runs-on: ubuntu-latest
steps:
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build project # This would actually build your project, using zip for an example artifact
id: build_
env:
GITHUB_NAME: ${{ github.event.repository.name }}


run: sudo apt-get install libxml-xpath-perl;echo $(xpath -e '/root/versions/version[num="'${GITHUB_REF/refs\/tags\//}'"]/compatibility/text()' $GITHUB_NAME.xml);echo ::set-output name=version_glpi::$(xpath -e '/root/versions/version[num="'${GITHUB_REF/refs\/tags\//}'"]/compatibility/text()' $GITHUB_NAME.xml); rm -rf $GITHUB_NAME.xml tools wiki screenshots test .git .github ISSUE_TEMPLATE.md TODO.txt $GITHUB_NAME.png;cd ..; tar -zcvf glpi-$GITHUB_NAME-${GITHUB_REF/refs\/tags\//}.tar.gz $GITHUB_NAME;ls -al;echo ::set-output name=tag::${GITHUB_REF/refs\/tags\//};echo ${{ steps.getxml.outputs.info }};
# run: rm -rf $GITHUB_NAME.xml tools wiki screenshots test ISSUE_TEMPLATE.md TODO.txt $GITHUB_NAME.png; tar -zcvf glpi-$GITHUB_NAME-$GITHUB_TAG.tar.gz $GITHUB_NAME
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: actions/checkout@v4

- name: Build project
run: |
cd /home/runner/work/purchaserequest/
rm -r purchaserequest/tools purchaserequest/.git purchaserequest/.github
tar -zcvf purchaserequest-${{ github.ref_name }}.tgz purchaserequest
- name: Upload release
uses: actions/upload-artifact@v4
with:
tag_name: ${{ github.ref }}
release_name: |
GLPI ${{ steps.build_.outputs.version_glpi }} : Version ${{ github.ref }} disponible / available
body : Version ${{ steps.build_.outputs.tag }} released for GLPI ${{ steps.build_.outputs.version_glpi }}
draft: false
prerelease: true
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_NAME: ${{ github.event.repository.name }}
name: purchaserequest-${{ github.ref_name }}.tgz
path: /home/runner/work/purchaserequest/purchaserequest-${{ github.ref_name }}.tgz

- name: Create release
uses: softprops/action-gh-release@v2
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: /home/runner/work/${{ github.event.repository.name }}/glpi-${{ github.event.repository.name }}-${{ steps.build_.outputs.tag }}.tar.gz
asset_name: glpi-${{ github.event.repository.name }}-${{ steps.build_.outputs.tag }}.tar.gz
asset_content_type: application/zip

files: /home/runner/work/purchaserequest/purchaserequest-${{ github.ref_name }}.tgz
body: "New release is available"
name: Purchase Request ${{ github.ref_name }}
draft: true
generate_release_notes: true

26 changes: 14 additions & 12 deletions .github/workflows/updatepot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,33 @@ on:
branches: [ main ]
paths-ignore:
- 'locales/**'
workflow_dispatch:

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
run:

name: Update POT

name: Update POT
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2

- name: install xgettext

run: sudo apt-get install gettext;

- name: Update POT
run: sh tools/extract_template.sh;


- name: Commit changes
uses: EndBug/add-and-commit@v5.1.0
uses: EndBug/add-and-commit@v9
with:
message: "Update POT"
author_name: CI bot
author_email: adminsys@itsm-ng.com
commit: --signoff
default_author: github_actor
message: "Generate POT"

- name: Push changes

uses: actions-go/push@v1

uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
4 changes: 0 additions & 4 deletions README.md

This file was deleted.

Binary file modified locales/en_GB.mo
Binary file not shown.
Binary file modified locales/fr_FR.mo
Binary file not shown.

0 comments on commit 45496ad

Please sign in to comment.