Release 2.13.5-1 #608
Workflow file for this run
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 | |
| run-name: Release ${{ inputs.tag }} | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: Tag | |
| required: true | |
| artifacts-name: | |
| description: Artifacts name to promote (optional - will be auto-detected if not provided) | |
| required: false | |
| jobs: | |
| verify-release: | |
| name: Verify if tag is valid | |
| runs-on: ubuntu-24.04 | |
| outputs: | |
| artifacts-name: ${{ steps.get-artifacts-name.outputs.artifacts-name }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Fetch tags | |
| run: git fetch --tags | |
| - name: Check if tag matches the branch name | |
| shell: bash | |
| run: | | |
| [[ "refs/heads/development/${{ github.event.inputs.tag }}" == "${{ github.ref }}."* ]] | |
| - name: Check if tag matches VERSION file | |
| shell: bash | |
| run: | | |
| source VERSION | |
| [[ "${{ github.event.inputs.tag }}" == "$VERSION_FULL" ]] | |
| - name: Check if tag has not already been created | |
| shell: bash | |
| run: | | |
| ! git show-ref --tags ${{ github.event.inputs.tag }} --quiet | |
| - name: Auto-derive artifacts name if not provided | |
| uses: actions/github-script@v7 | |
| id: get-artifacts-name | |
| with: | |
| script: | | |
| const { getBuildArtifact } = require('./.github/scripts/get-build-artifact'); | |
| const artifactsName = process.env.ARTIFACTS_NAME | |
| || await getBuildArtifact(github, context, core); | |
| core.setOutput('artifacts-name', artifactsName); | |
| env: | |
| ARTIFACTS_NAME: ${{ github.event.inputs.artifacts-name }} | |
| release: | |
| name: Release | |
| runs-on: ubuntu-24.04 | |
| needs: | |
| - verify-release | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Check if version is a pre-release | |
| shell: bash | |
| run: | | |
| source VERSION | |
| echo "VERSION=${VERSION}" >> $GITHUB_ENV | |
| echo "VERSION_SUFFIX=${VERSION_SUFFIX}" >> $GITHUB_ENV | |
| - name: Generate release notes | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| // Get all releases | |
| const { data: releases } = await github.rest.repos.listReleases({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| }); | |
| // Get the previous release tag | |
| const { getPreviousTag } = require('./.github/scripts/get-previous-tag'); | |
| const previous_tag = getPreviousTag(context.payload.inputs.tag, releases); | |
| if (!previous_tag) { | |
| core.warning("No previous version found"); | |
| return; | |
| } | |
| // Generate release notes | |
| const { data: releaseNotes } = await github.rest.repos.generateReleaseNotes({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| tag_name: context.payload.inputs.tag, | |
| target_commitish: context.sha, | |
| previous_tag_name: previous_tag, | |
| }); | |
| core.exportVariable('RELEASE_NOTES', releaseNotes.body); | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v2 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| name: Release ${{ github.event.inputs.tag }} | |
| tag_name: ${{ github.event.inputs.tag }} | |
| generate_release_notes: false | |
| body: ${{ env.RELEASE_NOTES }} | |
| target_commitish: ${{ github.sha }} | |
| prerelease: ${{ env.VERSION_SUFFIX != '' }} | |
| promote: | |
| runs-on: ubuntu-24.04 | |
| needs: | |
| - verify-release | |
| - release | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Promote artifacts | |
| uses: scality/action-artifacts@v4 | |
| with: | |
| method: promote | |
| name: ${{ needs.verify-release.outputs.artifacts-name }} | |
| tag: ${{ github.event.inputs.tag }} | |
| url: https://artifacts.scality.net | |
| user: ${{ secrets.ARTIFACTS_USER }} | |
| password: ${{ secrets.ARTIFACTS_PASSWORD }} |