torch-mlir/.github/workflows/releaseSnapshotPackage.yml

74 lines
2.3 KiB
YAML

# yamllint disable rule:line-length
name: Release snapshot package
on:
# schedule:
# - cron: '0 11 * * *'
workflow_dispatch:
jobs:
release_snapshot_package:
name: "Tag snapshot release"
runs-on: ubuntu-latest
# Don't run this in everyone's forks.
if: github.repository == 'llvm/torch-mlir'
steps:
- name: Prepare workspace
run: |
# Clear the workspace directory so that we don't run into errors about
# existing lock files.
sudo rm -rf $GITHUB_WORKSPACE/*
- name: Checking out repository
uses: actions/checkout@v3
with:
token: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}
- name: Compute version
run: |
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
package_version="$(printf '%(%Y%m%d)T.${{ github.run_number }}')"
tag_name="snapshot-${package_version}"
echo "package_version=${package_version}" >> $GITHUB_ENV
echo "tag_name=${tag_name}" >> $GITHUB_ENV
- name: Updating snapshot tag
run: |
git tag "${tag_name}"
- name: Pushing changes
uses: ad-m/github-push-action@v0.6.0
with:
github_token: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}
branch: main
tags: true
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}
with:
tag_name: ${{ env.tag_name }}
release_name: torch-mlir snapshot ${{ env.tag_name }}
body: |
Automatic snapshot release of torch-mlir.
draft: true
prerelease: false
- name: "Invoke workflow :: Build and Test"
uses: benc-uk/workflow-dispatch@v1
with:
workflow: Build and Test
token: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}
ref: "${{ env.tag_name }}"
- name: "Invoke workflow :: Release Build"
uses: benc-uk/workflow-dispatch@v1
with:
workflow: Release Build
token: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}
ref: "${{ env.tag_name }}"
inputs: '{"release_id": "${{ steps.create_release.outputs.id }}", "python_package_version": "${{ env.package_version }}"}'