|
1 | 1 | name: Deploy |
2 | 2 |
|
3 | 3 | on: |
4 | | - push: |
5 | | - branches: |
6 | | - - 'release/*' |
7 | | - workflow_run: |
8 | | - workflows: |
9 | | - - Bump Minor Version |
10 | | - types: |
11 | | - - completed |
| 4 | + release: |
| 5 | + types: [published] |
12 | 6 |
|
13 | 7 | jobs: |
14 | | - create_release: |
15 | | - name: Create Release and Tag |
16 | | - if: >- |
17 | | - github.event.workflow_run.conclusion == 'success' && |
18 | | - github.event.workflow_run.head_branch == 'main' |
19 | | - permissions: |
20 | | - contents: write |
21 | | - runs-on: ubuntu-latest |
22 | | - environment: production |
23 | | - steps: |
24 | | - - name: Generate token |
25 | | - id: generate_token |
26 | | - uses: actions/create-github-app-token@v1 |
27 | | - with: |
28 | | - app-id: ${{ secrets.VERSION_BUMP_APP_ID }} |
29 | | - private-key: ${{ secrets.VERSION_BUMP_APP_TOKEN }} |
30 | | - |
31 | | - - uses: actions/checkout@v4 |
32 | | - with: |
33 | | - token: ${{ steps.generate_token.outputs.token }} # Use the generated token |
34 | | - |
35 | | - - name: Install uv and dev dependencies |
36 | | - run: | |
37 | | - curl -LsSf https://astral.sh/uv/install.sh | sh |
38 | | - uv sync --only-dev |
39 | | -
|
40 | | - - name: Extract version |
41 | | - id: extract_version |
42 | | - run: | |
43 | | - echo "VERSION=$(uv run --no-sync poetry version -s)" >> $GITHUB_OUTPUT |
44 | | -
|
45 | | - - name: Create GitHub Release |
46 | | - uses: actions/create-release@v1 |
47 | | - with: |
48 | | - tag_name: v${{ steps.extract_version.outputs.VERSION }} |
49 | | - release_name: v${{ steps.extract_version.outputs.VERSION }} |
50 | | - body: "Release v${{ steps.extract_version.outputs.VERSION }}" |
51 | | - env: |
52 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
53 | | - |
54 | | - - name: Create and push release branch |
55 | | - env: |
56 | | - GH_TOKEN: ${{ steps.generate_token.outputs.token }} |
57 | | - run: | |
58 | | - git config user.name "${{ secrets.VERSION_BUMP_APP_ID }}[bot]" |
59 | | - git config user.email "${{ secrets.VERSION_BUMP_APP_ID }}[bot]@users.noreply.github.com" |
60 | | -
|
61 | | - git checkout -b "release/v${{ steps.extract_version.outputs.VERSION }}" |
62 | | -
|
63 | | - git remote set-url origin "https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }}.git" |
64 | | - git push origin "release/v${{ steps.extract_version.outputs.VERSION }}" |
65 | | -
|
66 | 8 | deploy_images: |
67 | 9 | name: Deploy Docker Images |
68 | | - if: >- |
69 | | - github.event_name == 'push' && |
70 | | - startsWith(github.ref, 'refs/heads/release/') |
71 | 10 | runs-on: ubuntu-latest |
72 | 11 | environment: production |
73 | 12 | steps: |
74 | | - - uses: actions/checkout@v4 |
75 | | - |
76 | | - - name: Install uv and dev dependencies |
77 | | - run: | |
78 | | - curl -LsSf https://astral.sh/uv/install.sh | sh |
79 | | - uv sync --only-dev |
| 13 | + - name: Checkout code at release tag |
| 14 | + uses: actions/checkout@v4 |
| 15 | + with: |
| 16 | + ref: ${{ github.event.release.tag_name }} |
80 | 17 |
|
81 | 18 | - name: Extract version |
82 | 19 | id: extract_version |
83 | 20 | run: | |
84 | | - echo "VERSION=$(uv run --no-sync poetry version -s)" >> $GITHUB_OUTPUT |
| 21 | + TAG_NAME="${{ github.event.release.tag_name }}" |
| 22 | + echo "VERSION=${TAG_NAME#v}" >> $GITHUB_OUTPUT |
85 | 23 |
|
86 | 24 | - name: Log in to Docker Hub |
87 | 25 | uses: docker/login-action@v2 |
|
0 commit comments