immich/.github/workflows/prepare-release.yml

113 lines
3.6 KiB
YAML

name: Prepare new release
on:
workflow_dispatch:
inputs:
releaseType:
description: 'Release type'
required: true
default: 'preminor'
type: choice
options:
- premajor
- preminor
- patch
- prerelease
- release
skipTranslations:
description: 'Skip translations'
required: false
type: boolean
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-root
cancel-in-progress: true
permissions: {}
jobs:
merge_translations:
uses: ./.github/workflows/merge-translations.yml
with:
skip: ${{ inputs.skipTranslations || github.ref_name != 'main' }}
permissions:
pull-requests: write
secrets:
PUSH_O_MATIC_APP_CLIENT_ID: ${{ secrets.PUSH_O_MATIC_APP_CLIENT_ID }}
PUSH_O_MATIC_APP_KEY: ${{ secrets.PUSH_O_MATIC_APP_KEY }}
WEBLATE_TOKEN: ${{ secrets.WEBLATE_TOKEN }}
bump_version:
runs-on: ubuntu-latest
needs: [merge_translations]
outputs:
version: ${{ steps.output.outputs.version }}
permissions: {}
steps:
- name: Check the release type suits this branch
env:
BRANCH: ${{ github.ref_name }}
RELEASE_TYPE: ${{ inputs.releaseType }}
run: |
case "${BRANCH}:${RELEASE_TYPE}" in
main:premajor | main:preminor) ;;
release/*:patch | release/*:prerelease | release/*:release) ;;
*)
echo "::error::${RELEASE_TYPE} cannot be released from ${BRANCH}"
exit 1
;;
esac
- id: token
uses: immich-app/devtools/actions/create-workflow-token@1af396ae134e4bc3b63d947e672bc68bf4ff9dc5 # create-workflow-token-action-v3.0.0
with:
client-id: ${{ secrets.PUSH_O_MATIC_APP_CLIENT_ID }}
private-key: ${{ secrets.PUSH_O_MATIC_APP_KEY }}
permission-contents: write
permission-issues: write
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.ref_name }}
token: ${{ steps.token.outputs.token }}
persist-credentials: true
- name: Setup Mise
uses: immich-app/devtools/actions/use-mise@06a9ef925332c91be647d6256642b86b398592c8 # use-mise-action-v3.2.1
with:
github_token: ${{ steps.token.outputs.token }}
# TODO move to mise
- name: Install uv
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
- name: Bump version
env:
RELEASE_TYPE: ${{ inputs.releaseType }}
run: mise //:release --type "${RELEASE_TYPE}"
- id: output
run: echo "version=$IMMICH_VERSION" >> $GITHUB_OUTPUT
- name: Commit
env:
VERSION: ${{ steps.output.outputs.version }}
run: |
git config user.name 'immich-push-o-matic[bot]'
git config user.email '179150890+immich-push-o-matic[bot]@users.noreply.github.com'
git add -A
git commit -m "chore: version ${VERSION}"
git push
- name: Cut the release branch
if: ${{ github.ref_name == 'main' }}
env:
GH_TOKEN: ${{ steps.token.outputs.token }}
VERSION: ${{ steps.output.outputs.version }}
run: |
line=$(sed -E 's/^(v[0-9]+\.[0-9]+).*/\1/' <<< "${VERSION}")
git push origin "HEAD:refs/heads/release/${line}"
gh label create "backport:release/${line}" --force \
--description "Backport this pull request to release/${line}" \
--color 5319e7