Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
New release flow (#16805)
Cezary Miącz8683f4228d40
diff --git a/.github/workflows/create-tag-with-release-pr.yml b/.github/workflows/create-tag-with-release-pr.ymlnew file mode 100644index 0000000000..c84fad0463--- /dev/null+++ b/.github/workflows/create-tag-with-release-pr.yml@@ -0,0 +1,84 @@+name: Create release tag on release PR merge+on:+ pull_request:+ types:+ - closed++jobs:+ create-release-tag:+ runs-on: ubuntu-24.04+ if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'release')+ env:+ GH_REF: ${{ github.event.pull_request.head.ref }}+ GH_TOKEN: ${{ github.token }}+ outputs:+ version: ${{ steps.set-version.outputs.VERSION }}+ steps:+ - name: Set version+ id: set-version+ run: echo "VERSION=$GH_REF" | sed "s/release-//" >> $GITHUB_OUTPUT+ - name: Check latest version+ id: check-latest+ env:+ VERSION: ${{ steps.set-version.outputs.VERSION }}+ run: |+ latest=$(gh api --jq .name /repos/saleor/saleor/releases/latest)+ if [ "$VERSION" \> "$latest" ]+ then+ echo "IS_LATEST=true" >> $GITHUB_OUTPUT+ else+ echo "IS_LATEST=false" >> $GITHUB_OUTPUT+ fi+ - name: Create tag+ uses: actions/github-script@v5+ env:+ VERSION: ${{ steps.set-version.outputs.VERSION }}+ with:+ script: |+ github.rest.git.createRef({+ owner: context.repo.owner,+ repo: context.repo.repo,+ ref: `refs/tags/${process.env.VERSION}`,+ sha: context.sha+ })+ - name: Create github release+ env:+ VERSION: ${{ steps.set-version.outputs.VERSION }}+ IS_LATEST: ${{ steps.check-latest.outputs.IS_LATEST }}+ run: |+ gh release create "$VERSION" --repo="$GITHUB_REPOSITORY" --latest="$IS_LATEST" --generate-notes --verify-tag++ publish:+ needs:+ - create-release-tag+ uses: ./.github/workflows/publish-containers.yml+ with:+ version: ${{ needs.create-release-tag.outputs.version }}+ ref: ${{ needs.create-release-tag.outputs.version }}+ secrets:+ SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CLOUD_CI_WEBHOOK_URL }}+ SLACK_MENTION_GROUP_ID: ${{ secrets.SLACK_CORE_SUPPORT_GROUP_ID }}++ deploy:+ runs-on: ubuntu-24.04+ needs:+ - publish+ steps:+ - name: Trigger staging deployment for tagged release+ env:+ VERSION: ${{ needs.publish.outputs.version }}+ run: |+ export GITHUB_TOKEN=$( \+ curl --request GET --url ${{ secrets.VAULT_URL}} --header "Authorization: JWT ${{ secrets.VAULT_JWT }}" | jq -r .token \+ )++ payload=$(+ jq --arg version "$VERSION" --null-input '+ {+ "event_type": "deploy-staging",+ "client_payload": {"version": $version}+ }+ '+ )++ gh api /repos/saleor/saleor-multitenant/dispatches --input - <<< "$payload"diff --git a/.github/workflows/publish-containers.yml b/.github/workflows/publish-containers.ymlindex 84054d0410..2ce155e80d 100644--- a/.github/workflows/publish-containers.yml+++ b/.github/workflows/publish-containers.yml@@ -3,6 +3,10 @@ name: Publishon:workflow_call:inputs:+ ref:+ description: Optional ref name for custom build+ required: false+ type: stringprefix:description: Optional image prefix for branch buildrequired: false@@ -21,7 +25,7 @@ on:jobs:docker:- runs-on: ubuntu-20.04+ runs-on: ubuntu-24.04permissions:contents: read@@ -33,6 +37,8 @@ jobs:steps:- name: Checkoutuses: actions/checkout@v4+ with:+ ref: ${{ inputs.ref }}# Outputs the name of the repository (owner/repo)- name: Build Image Name@@ -53,6 +59,7 @@ jobs:type=pep440,pattern={{version}}type=pep440,pattern={{major}}.{{minor}}type=raw,value=${{ inputs.version }},enable=${{ inputs.version != null }}+ context: git- name: Set up QEMUuses: docker/setup-qemu-action@v3diff --git a/.gitignore b/.gitignoreindex ad9cb08154..07e0c7c8f4 100644--- a/.gitignore+++ b/.gitignore@@ -9,6 +9,8 @@*.pot*.pyclocal_settings.py+.release_changelog.txt+.base_ver_release.txt__pycache__/build/coverage/diff --git a/.release-it.json b/.release-it.jsonindex c53360182f..547826e88c 100644--- a/.release-it.json+++ b/.release-it.json@@ -1,11 +1,12 @@{+ "git": {+ "commit": true,+ "tag": false,+ "push": false+ },"github": {- "release": true,- "draft": true,- "releaseName": "${version}",- "assets": ["saleor/graphql/schema.graphql"]+ "release": false},-"npm": {"publish": false},@@ -22,5 +23,19 @@}]}+ },+ "hooks": {+ "before:bump": [+ "git rev-parse --abbrev-ref HEAD > .base_ver_release.txt"+ ],+ "after:bump": [+ "git checkout -B release-${version} --track"+ ],+ "after:release": [+ "git push origin release-${version}",+ "npx release-it --changelog > .release_changelog.txt",+ "gh pr create --base `cat .base_ver_release.txt` --head release-${version} --title \"Release ${version}\" --body-file '.release_changelog.txt' --label release --assignee @me",+ "rm .release_changelog.txt .base_ver_release.txt"+ ]}}