Skip to content

Start release

Start release #67

Workflow file for this run

name: Start release
# There are a lot of builds for different languages that all need to agree on what the version is. To start a release, somebody
# pushes a branch starting with "release-v". This workflow will then:
# - Edit all the files that need to know the name of the release.
# - Commit those files.
# - Make a new PR for the release.
# - Add a comment to the PR explaining what's going on.
# When the release PR is merged, it triggers the second release workflow.
on: create
jobs:
# Starts the release process for this repository.
kickoff:
if: github.event.ref_type == 'branch' && startsWith(github.event.ref, 'release-')
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
# If we use the default GITHUB_TOKEN, it won't run our CI job once we create a PR. The WORKFLOW_PAT is a personal
# access token with "repo" permissions.
token: ${{ secrets.WORKFLOW_PAT }}
- name: Configure git
run: |
git config --local user.email ops@ironcorelabs.com
git config --local user.name "Leeroy Travis"
- uses: IronCoreLabs/rust-toolchain@v1
- name: Calculate versions from github.ref
id: version
run: |
CURRENT=$(basename ${{ github.ref }})
NAME=$(echo ${CURRENT} | sed 's/release-//')
NUMBER=$(echo ${NAME} | sed -E -e 's/[^0-9.]+/./g' -e 's/\.+/./g' -e 's/^\.//' -e 's/\.$//')
echo "tag=${NAME}" >> "$GITHUB_OUTPUT"
echo "dewey=${NUMBER}" >> "$GITHUB_OUTPUT"
- name: Edit files for release
run: .github/set-versions.sh ${{ steps.version.outputs.dewey }}
- name: Update Cargo.lock
run: cargo update -p ironoxide-android -p ironoxide-cpp -p ironoxide-java
- run: git add Cargo.lock
- run: git commit -m "Setting version to ${{ steps.version.outputs.tag }}"
- run: git push
- name: Create PR
run: |
curl --silent --show-error --fail -X POST \
-H "Authorization: token ${{ github.token }}" \
-H "Content-Type: application/json" \
--data '{"title": "Release ${{ steps.version.outputs.tag }}",
"head": "${{ github.ref }}",
"base": "${{ github.event.master_branch }}",
"body": "The release will be built when this PR is merged. Or close the PR to abort the release process."
}' \
https://api.github.com/repos/${{ github.repository }}/pulls