Release MCK version #3
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 MCK version | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| commit_sha: | |
| description: 'SHA of the commit to release' | |
| type: string | |
| required: true | |
| version: | |
| description: 'Version to release' | |
| required: true | |
| type: string | |
| jobs: | |
| crate_draft_release_notes: | |
| name: Create draft Release Notes | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: '0' | |
| - name: Setup host | |
| uses: ./.github/actions/setup-ubuntu-host | |
| with: | |
| python-version: '${{ vars.PYTHON_VERSION }}' | |
| - name: Generate Release Notes | |
| id: generate_release_notes | |
| run: python -m scripts.release.release_notes -s $INITIAL_COMMIT_SHA -v $INITIAL_VERSION -o release_notes_final.md | |
| env: | |
| INITIAL_COMMIT_SHA: ${{ vars.RELEASE_INITIAL_COMMIT_SHA }} | |
| INITIAL_VERSION: ${{ vars.RELEASE_INITIAL_VERSION }} | |
| - name: Generate draft release | |
| run: | | |
| gh release create $VERSION --target $COMMIT_SHA --draft --prerelease --latest --notes-file release_notes_final.md --title "Release of MCK $VERSION" | |
| env: | |
| VERSION: ${{ github.event.inputs.version }} | |
| COMMIT_SHA: ${{ github.event.inputs.commit_sha }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| approve_release: | |
| name: Approve Release | |
| environment: production | |
| runs-on: ubuntu-latest | |
| needs: crate_draft_release_notes | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: '0' | |
| - name: Create git tag | |
| run: | | |
| git config user.name 'github-actions[bot]' | |
| git config user.email 'github-actions[bot]@users.noreply.github.com' | |
| git tag -a $VERSION -m "Release of MCK $VERSION" | |
| git push origin $VERSION | |
| env: | |
| VERSION: ${{ github.event.inputs.version }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| publish_release: | |
| name: Publish Release | |
| environment: production | |
| runs-on: ubuntu-latest | |
| needs: approve_release | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: '0' | |
| - name: Publish Release Notes | |
| run: | | |
| gh release edit $VERSION --draft=false --verify-tag | |
| env: | |
| VERSION: ${{ github.event.inputs.version }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |