diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..9671f67a9 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,79 @@ +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 with 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: Create Git Tag + start Evergreen jobs + 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 --latest + env: + VERSION: ${{ github.event.inputs.version }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}