Add a oneshot build and allow building on a branch (#8746)
Allow oneshot to build from Nod.ai's fork too.
Also remove hardcode for "main" branch
TEST=Able to build on custom shark branch
https://github.com/NodLabs/SHARK/actions/runs/2080070703
diff --git a/.github/workflows/oneshot_candidate_release.yml b/.github/workflows/oneshot_candidate_release.yml
new file mode 100644
index 0000000..d998ecc
--- /dev/null
+++ b/.github/workflows/oneshot_candidate_release.yml
@@ -0,0 +1,54 @@
+name: Oneshot candidate release
+
+on:
+ workflow_dispatch:
+
+jobs:
+ tag_release:
+ name: "Tag candidate release"
+ runs-on: ubuntu-18.04
+ steps:
+ - name: Checking out repository
+ uses: actions/checkout@v2
+ with:
+ token: ${{ secrets.WRITE_ACCESS_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="candidate-${package_version}"
+ echo "package_version=${package_version}" >> $GITHUB_ENV
+ echo "tag_name=${tag_name}" >> $GITHUB_ENV
+
+ - name: Updating candidate tag
+ run: |
+ git tag "${tag_name}"
+
+ - name: Pushing changes
+ uses: ad-m/github-push-action@v0.6.0
+ with:
+ github_token: ${{ secrets.WRITE_ACCESS_TOKEN }}
+ branch: ${{ env.ref }}
+ tags: true
+
+ - name: Create Release
+ id: create_release
+ uses: actions/create-release@v1
+ env:
+ GITHUB_TOKEN: ${{ secrets.WRITE_ACCESS_TOKEN }}
+ with:
+ tag_name: ${{ env.tag_name }}
+ release_name: iree candidate ${{ env.tag_name }}
+ body: |
+ Automatic candidate release of iree.
+ draft: true
+ prerelease: true
+
+ - name: "Invoke workflow :: Build Native Release Packages"
+ uses: benc-uk/workflow-dispatch@v1
+ with:
+ workflow: Build Native Release Packages
+ token: ${{ secrets.WRITE_ACCESS_TOKEN }}
+ ref: "${{ env.tag_name }}"
+ inputs: '{"package_suffix": "", "package_version": "${{ env.package_version }}", "release_id": "${{ steps.create_release.outputs.id }}"}'