release #9
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| required: true | |
| default: 'x.y.z' | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| version: | |
| runs-on: ubuntu-24.04 | |
| name: prepare ${{ github.event.inputs.version }} | |
| steps: | |
| - name: Install xmlstartlet | |
| run: sudo apt install xmlstarlet | |
| - name: checkout | |
| uses: actions/checkout@v6.0.2 | |
| - name: Inject version number into plugin source | |
| run: xmlstarlet ed --inplace -u "/extension/version" -v v${{ github.event.inputs.version }} com_ccpbiosim/ccpbiosim.xml | |
| - name: Inject version number into update.xml | |
| run: xmlstarlet ed --omit-decl --inplace -u "/updates/update/version" -v v${{ github.event.inputs.version }} update.xml | |
| - name: Inject update file path into update.xml | |
| run: xmlstarlet ed --omit-decl --inplace -u "/updates/update/downloads/downloadurl" -v "https://github.com/ccpbiosim/com_ccpbiosim/releases/download/${{ github.event.inputs.version }}/com_ccpbiosim-${{ github.event.inputs.version }}.zip" update.xml | |
| - name: Send version update PR | |
| id: pr_id | |
| uses: peter-evans/create-pull-request@v8.1.0 | |
| with: | |
| commit-message: Update version to ${{ github.event.inputs.version }} | |
| branch: version-update | |
| title: "Update to version ${{ github.event.inputs.version }}" | |
| body: | | |
| Update version | |
| - Update com_ccpbiosim/ccpbiosim.xml | |
| - Update the update.xml with new release | |
| - Auto-generated by [create-pull-request] | |
| base: main | |
| signoff: false | |
| draft: false | |
| - name: Auto merge PR | |
| run: gh pr merge --merge --delete-branch --auto "${{ steps.pr_id.outputs.pull-request-number }}" | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| release: | |
| name: Create GH release. | |
| needs: version | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6.0.2 | |
| with: | |
| ref: main | |
| - name: Tag v${{ github.event.inputs.version }} | |
| run: | | |
| git config user.name github-actions | |
| git config user.email github-actions@github.com | |
| git tag ${{ github.event.inputs.version }} | |
| git push origin tag ${{ github.event.inputs.version }} | |
| - name: Create zip | |
| run: | | |
| zip -r com_ccpbiosim-${{ github.event.inputs.version }}.zip com_ccpbiosim | |
| - name: Create release | |
| uses: softprops/action-gh-release@v2.5.0 | |
| with: | |
| name: v${{ github.event.inputs.version }} | |
| generate_release_notes: true | |
| tag_name: ${{ github.event.inputs.version }} | |
| files: com_ccpbiosim-${{ github.event.inputs.version }}.zip |