Package and release #317
This file contains 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: Package and release | |
on: | |
workflow_dispatch: | |
schedule: | |
# Create rc every day at EOD of PST Mon-Fri + night of Sunday to kick off | |
# releases for beginning of work week | |
- cron: "0 1 * * 1,2,3,4,5,6" | |
permissions: | |
contents: write | |
packages: write | |
jobs: | |
single-card-demos: | |
uses: ./.github/workflows/single-card-demo-tests.yaml | |
secrets: inherit | |
get-params: | |
runs-on: ubuntu-latest | |
outputs: | |
is-release-candidate: ${{ steps.get-is-release-candidate.outputs.is-release-candidate }} | |
should-create-release: ${{ steps.get-should-create-release.outputs.should-create-release }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Get is-release-candidate | |
id: get-is-release-candidate | |
run: | | |
# A workflow dispatch on a tag is considered a release run for us. | |
isReleaseCandidate=${{ !(github.ref_type == 'tag' && github.event_name == 'workflow_dispatch') }} | |
echo "is-release-candidate=$isReleaseCandidate" >> "$GITHUB_OUTPUT" | |
- name: Get should-create-release | |
id: get-should-create-release | |
run: | | |
# Run once to check for errors | |
./scripts/build_scripts/get_should_create_release.sh ${{ fromJSON(steps.get-is-release-candidate.outputs.is-release-candidate) && '--release-candidate' || '' }} | |
shouldCreateRelease=$(scripts/build_scripts/get_should_create_release.sh ${{ fromJSON(steps.get-is-release-candidate.outputs.is-release-candidate) && '--release-candidate' || '' }}) | |
echo "should-create-release=$shouldCreateRelease" >> "$GITHUB_OUTPUT" | |
create-tag: | |
needs: get-params | |
if: ${{ fromJSON(needs.get-params.outputs.should-create-release) }} | |
uses: tenstorrent-metal/metal-workflows/.github/workflows/release-verify-or-create-tag.yaml@v2.0.1 | |
with: | |
fetch_depth: 0 | |
bump_each_commit: false | |
release_candidate_suffix: ${{ needs.get-params.outputs.is-release-candidate && fromJSON(needs.get-params.outputs.is-release-candidate) }} | |
create-changelog: | |
needs: create-tag | |
permissions: read-all | |
runs-on: ubuntu-latest | |
steps: | |
- name: Create changelog | |
id: create-changelog | |
uses: mikepenz/release-changelog-builder-action@v4 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
ignorePreReleases: true | |
failOnError: true | |
outputFile: CHANGELOG.txt | |
- name: Output changelog | |
run: cat CHANGELOG.txt | |
- name: Upload changelog as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: changelog | |
path: CHANGELOG.txt | |
create-release-notes: | |
needs: create-changelog | |
permissions: read-all | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download changelog | |
uses: actions/download-artifact@v4 | |
with: | |
name: changelog | |
- name: Create note about generating pipeline | |
shell: bash | |
run: echo "${{ format('This release was generated by the CI workflow https://github.com/{0}/actions/runs/{1}', github.repository, github.run_id) }}" > PIPELINE_NOTE.txt | |
- name: Create release notes by concatenating parts | |
shell: bash | |
run: | | |
touch RELEASE_NOTES.txt | |
cat infra/RELEASE_TOP_NOTE.txt >> RELEASE_NOTES.txt | |
echo "" >> RELEASE_NOTES.txt | |
cat PIPELINE_NOTE.txt >> RELEASE_NOTES.txt | |
echo "" >> RELEASE_NOTES.txt | |
cat CHANGELOG.txt >> RELEASE_NOTES.txt | |
- name: Output release notes | |
run: cat RELEASE_NOTES.txt | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: release-notes | |
path: RELEASE_NOTES.txt | |
build-eager-package: | |
needs: create-tag | |
strategy: | |
matrix: | |
os: [ubuntu-20.04] | |
arch: [grayskull, wormhole_b0] | |
uses: ./.github/workflows/eager-package.yaml | |
with: | |
environment: dev | |
os: ${{ matrix.os }} | |
arch: ${{ matrix.arch }} | |
# Candidate for breaking up | |
create-and-upload-draft-release: | |
needs: [ | |
create-tag, | |
create-release-notes, | |
build-eager-package, | |
] | |
strategy: | |
matrix: | |
os: [ubuntu-20.04] | |
arch: [grayskull, wormhole_b0] | |
# May accidentally create two releases without restricting to 1 job | |
concurrency: create_upload_draft_release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download eager Python packages | |
uses: actions/download-artifact@v4 | |
with: | |
name: eager-dist-${{ matrix.os }}-${{ matrix.arch }} | |
- name: Create VERSION | |
run: echo ${{ needs.create-tag.outputs.version }} > VERSION | |
- name : Download release notes | |
uses: actions/download-artifact@v4 | |
with: | |
name: release-notes | |
- name : Download changelog | |
uses: actions/download-artifact@v4 | |
with: | |
name: changelog | |
- name: Assert wheels exist | |
run: ls -arhl metal_libs-*+*.whl | |
- name: Release | |
# A major release has not been tagged yet, so we need to do this to avoid | |
# Node 16 deprecation warning message | |
uses: softprops/action-gh-release@4634c16e79c963813287e889244c50009e7f0981 | |
with: | |
tag_name: ${{ needs.create-tag.outputs.version }} | |
name: ${{ needs.create-tag.outputs.version }} | |
draft: false | |
prerelease: true | |
body_path: RELEASE_NOTES.txt | |
files: | | |
VERSION | |
CHANGELOG.txt | |
README.md | |
INSTALLING.md | |
infra/machine_setup/scripts/setup_hugepages.py | |
metal_libs-*+*.whl | |
fail_on_unmatched_files: true | |
create-docker-image: | |
needs: [ | |
create-tag, | |
create-and-upload-draft-release | |
] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: https://ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
env: | |
TT_METAL_DOCKER_IMAGE: tt-metalium/ubuntu-20.04-amd64 | |
uses: docker/build-push-action@v6 | |
with: | |
push: true | |
tags: ghcr.io/${{ github.repository }}/tt-metalium/ubuntu-20.04-amd64:${{ needs.create-tag.outputs.version }}-dev | |
context: . | |
file: dockerfile/ubuntu-20.04-amd64.Dockerfile |