Skip to content

chore: upgrade cargo dependencies #66

chore: upgrade cargo dependencies

chore: upgrade cargo dependencies #66

Workflow file for this run

## DO NOT EDIT!
# This file was provisioned by Terraform
# File origin: https://github.com/Arrow-air/tf-github/tree/main/src/templates/rust-all/.github/workflows/release.yml
name: Tag and Release
on:
pull_request:
types:
- closed
branches:
- 'main'
- 'develop'
workflow_dispatch:
env:
TERM: xterm
jobs:
prepare:
if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
name: Create Tag and Release notes
permissions:
contents: write
packages: write
deployments: write
pull-requests: write
runs-on: ubuntu-latest
concurrency:
group: release-${{ github.head_ref || 'main' }}
steps:
- name: Import Arrow bot's GPG key for signing commits
id: import-gpg
uses: crazy-max/ghaction-import-gpg@v4
with:
gpg_private_key: ${{ secrets.COMMITBOT_GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.COMMITBOT_GPG_PASSPHRASE }}
git_config_global: true
git_user_signingkey: true
git_commit_gpgsign: true
git_tag_gpgsign: true
- name: Checkout Code
uses: actions/checkout@v3
with:
token: ${{ secrets.COMMITBOT_GITHUB_TOKEN }}
fetch-depth: 0
- name: Set up environment based on branch
run: |
if [ "$GITHUB_REF_NAME" != "main" ]
then
echo "CUSTOM_RELEASE_RULES=fix:prerelease,feat:prerelease,chore:prerelease" >> $GITHUB_ENV
echo "RELEASE_COMMIT_MESSAGE=fixup! ci: update release files\n\n[skip ci]" >> $GITHUB_ENV
echo "LATEST_TAG=latest-${GITHUB_REF_NAME}" >> $GITHUB_ENV
else
echo "RELEASE_COMMIT_MESSAGE=ci: update release files\n\n[skip ci]" >> $GITHUB_ENV
echo "LATEST_TAG=latest" >> $GITHUB_ENV
fi
- name: Determine new Tag
uses: mathieudutour/[email protected]
id: tag_version
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
pre_release_branches: develop
dry_run: true
custom_release_rules: "${{ env.CUSTOM_RELEASE_RULES }}"
- name: Automatic Rebase Autosquash
if: ${{ github.ref_name == 'develop' }}
run: |
git rebase -i --autosquash origin/main
continue-on-error: true
env:
GIT_AUTHOR_NAME: ${{ steps.import-gpg.outputs.name }}
GIT_AUTHOR_EMAIL: ${{ steps.import-gpg.outputs.email }}
GIT_COMMITTER_NAME: ${{ steps.import-gpg.outputs.name }}
GIT_COMMITTER_EMAIL: ${{ steps.import-gpg.outputs.email }}
# git rebase with auto squash will be a noop if not run in interactive mode.
# using ':' or 'true' as the sequence editor allows us to automatically apply the squash actions
# https://git-scm.com/docs/git-config#Documentation/git-config.txt-sequenceeditor
GIT_SEQUENCE_EDITOR: ':'
- name: Generate Changelog
id: changelog
uses: mrchief/[email protected]
with:
previousReleaseTagNameOrSha: ${{ steps.tag_version.outputs.previous_tag }}
nextReleaseTagName: ${{ github.sha }}
nextReleaseName: "Release ${{ steps.tag_version.outputs.new_version }}"
- name: Update CHANGELOG.md
if: ${{ github.ref_name == 'main' }}
run: |
cat - CHANGELOG.md > temp <<'CHANGELOG.md-EOF'
${{ steps.changelog.outputs.changelog }}
CHANGELOG.md-EOF
sed -i 's/releases\/tag\/${{ github.sha }}/releases\/tag\/${{ steps.tag_version.outputs.new_tag }}/g' temp
mv temp CHANGELOG.md
- name: Add release tag to .terraform_init
if: ${{ github.ref_name == 'main' }}
run: echo "${{ steps.tag_version.outputs.new_tag }}" >> .terraform_init
- name: Update package version
run: |
cargo install cargo-edit
cargo set-version ${{ steps.tag_version.outputs.new_version }}
cargo update
make toml-tidy
cargo update
- name: Commit and push release updates
env:
CHANGED_FILES: "${{ vars.RELEASE_COMMIT_FILES }}"
GIT_AUTHOR_NAME: ${{ steps.import-gpg.outputs.name }}
GIT_AUTHOR_EMAIL: ${{ steps.import-gpg.outputs.email }}
GIT_COMMITTER_NAME: ${{ steps.import-gpg.outputs.name }}
GIT_COMMITTER_EMAIL: ${{ steps.import-gpg.outputs.email }}
# git rebase with auto squash will be a noop if not run in interactive mode.
# using ':' or 'true' as the sequence editor allows us to automatically apply the squash actions
# https://git-scm.com/docs/git-config#Documentation/git-config.txt-sequenceeditor
GIT_SEQUENCE_EDITOR: ':'
run: |
git commit $CHANGED_FILES -m "$(echo -e $RELEASE_COMMIT_MESSAGE)"
- name: Push any changes
run: |
git push -f
# set COMMIT_SHA env var with new current sha as it is used for tagging in the next step
echo "COMMIT_SHA=$(git rev-parse --verify HEAD)" >> $GITHUB_ENV
- name: Set and Push New Tags
env:
GIT_AUTHOR_NAME: ${{ steps.import-gpg.outputs.name }}
GIT_AUTHOR_EMAIL: ${{ steps.import-gpg.outputs.email }}
GIT_COMMITTER_NAME: ${{ steps.import-gpg.outputs.name }}
GIT_COMMITTER_EMAIL: ${{ steps.import-gpg.outputs.email }}
GIT_SEQUENCE_EDITOR: ':'
continue-on-error: true
run: |
git tag v${{ steps.tag_version.outputs.new_version }} ${{ env.COMMIT_SHA }} -m ""
git tag -f ${{ env.LATEST_TAG }} ${{ env.COMMIT_SHA }} -m ""
git push -f --tags
- name: Generate Changelog based on new tag
id: changelog_release
uses: mrchief/[email protected]
with:
previousReleaseTagNameOrSha: ${{ steps.tag_version.outputs.previous_tag }}
nextReleaseTagName: ${{ steps.tag_version.outputs.new_tag }}
nextReleaseName: "Release ${{ steps.tag_version.outputs.new_version }}"
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.COMMITBOT_GITHUB_TOKEN }}
with:
tag_name: ${{ steps.tag_version.outputs.new_tag }}
release_name: Release ${{ steps.tag_version.outputs.new_version }}
body: ${{ steps.changelog_release.outputs.changelog }}
draft: false
prerelease: ${{ github.ref_name == 'develop' }}
- name: Reset develop branch to main
if: ${{ github.ref_name == 'main' }}
run: |
git checkout develop
git reset --hard origin/main
git push -f
continue-on-error: true
env:
GIT_AUTHOR_NAME: ${{ steps.import-gpg.outputs.name }}
GIT_AUTHOR_EMAIL: ${{ steps.import-gpg.outputs.email }}
GIT_COMMITTER_NAME: ${{ steps.import-gpg.outputs.name }}
GIT_COMMITTER_EMAIL: ${{ steps.import-gpg.outputs.email }}