|
|
@@ -0,0 +1,89 @@
|
|
|
+name: Create release with tag
|
|
|
+
|
|
|
+on:
|
|
|
+ push:
|
|
|
+ # Sequence of patterns matched against refs/heads
|
|
|
+ branches:
|
|
|
+ - '*.*.*' # Push events to matching ex:20.15.10
|
|
|
+
|
|
|
+env:
|
|
|
+ TAG_VALUE: ${GITHUB_REF/refs\/heads\//}
|
|
|
+ PR_BRANCH: release-ci-${{ github.sha }}
|
|
|
+
|
|
|
+jobs:
|
|
|
+ generate-changelog:
|
|
|
+ name: Generate Changelog
|
|
|
+ runs-on: ubuntu-latest
|
|
|
+ steps:
|
|
|
+ - name: Checkout code
|
|
|
+ uses: actions/checkout@v2
|
|
|
+
|
|
|
+ - name: 🏷️ Create/update tag
|
|
|
+ uses: actions/github-script@v7
|
|
|
+ with:
|
|
|
+ script: |
|
|
|
+ github.rest.git.createRef({
|
|
|
+ owner: context.repo.owner,
|
|
|
+ repo: context.repo.repo,
|
|
|
+ ref: 'refs/tags/${{ github.ref_name }}',
|
|
|
+ sha: context.sha
|
|
|
+ }).catch(err => {
|
|
|
+ if (err.status !== 422) throw err;
|
|
|
+ })
|
|
|
+
|
|
|
+ - name: Update CHANGELOG
|
|
|
+ id: changelog
|
|
|
+ uses: requarks/changelog-action@v1
|
|
|
+ with:
|
|
|
+ token: ${{ github.token }}
|
|
|
+ tag: ${{ github.ref_name }}
|
|
|
+ writeToFile: true
|
|
|
+ #excludeTypes: build,docs,style
|
|
|
+ #includeInvalidCommits: true
|
|
|
+
|
|
|
+ - name: Commit CHANGELOG.md
|
|
|
+ uses: stefanzweifel/git-auto-commit-action@v4
|
|
|
+ with:
|
|
|
+ branch: master
|
|
|
+ commit_message: 'docs: update CHANGELOG.md for ${{ github.ref_name }} [skip ci]'
|
|
|
+ file_pattern: CHANGELOG.md
|
|
|
+
|
|
|
+ build:
|
|
|
+ name: Upload Release Asset
|
|
|
+ permissions: write-all
|
|
|
+ runs-on: ubuntu-latest
|
|
|
+ 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\/heads\/v/}'"]/compatibility/text()' plugin.xml);echo ::set-output name=version_glpi::$(xpath -e '/root/versions/version[num="'${GITHUB_REF/refs\/heads\/v/}'"]/compatibility/text()' plugin.xml); rm -rf plugin.xml tools wiki screenshots test .git .github ISSUE_TEMPLATE.md TODO.txt $GITHUB_NAME.png;cd ..; tar jcvf $GITHUB_NAME-${GITHUB_REF/refs\/heads\//}.tar.bz2 $GITHUB_NAME;ls -al;echo ::set-output name=tag::${GITHUB_REF/refs\/heads\//};echo ${{ steps.getxml.outputs.info }};
|
|
|
+ # run: rm -rf plugin.xml tools wiki screenshots test ISSUE_TEMPLATE.md TODO.txt $GITHUB_NAME.png; tar -zcvf $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 }}
|
|
|
+ with:
|
|
|
+ tag_name: ${{ steps.build_.outputs.tag }}
|
|
|
+ release_name: |
|
|
|
+ GLPI ${{ steps.build_.outputs.version_glpi }} : Version ${{ steps.build_.outputs.tag }} disponible / available
|
|
|
+ body : Version ${{ steps.build_.outputs.tag }} released for GLPI ${{ steps.build_.outputs.version_glpi }}. The [full changelog is available](https://github.com/edgardmessias/glpi-singlesignon/blob/${{ steps.build_.outputs.tag }}/CHANGELOG.md) for more details.
|
|
|
+ draft: false
|
|
|
+ prerelease: false
|
|
|
+
|
|
|
+ - 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 }}
|
|
|
+ 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 }}/${{ github.event.repository.name }}-${{ steps.build_.outputs.tag }}.tar.bz2
|
|
|
+ asset_name: ${{ github.event.repository.name }}-${{ steps.build_.outputs.tag }}.tar.bz2
|
|
|
+ asset_content_type: application/zip
|