Skip to content

Commit c720999

Browse files
committed
fix: reorganize steps
1 parent 2863b8b commit c720999

File tree

1 file changed

+37
-31
lines changed

1 file changed

+37
-31
lines changed

.github/workflows/prepare-tag.yml

Lines changed: 37 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,14 @@ on:
1010
default: next
1111

1212
jobs:
13-
prepare-tag:
13+
get-version:
1414
runs-on: ubuntu-latest
1515
outputs:
1616
version: ${{ steps.version.outputs.version }}
1717
steps:
1818
- name: Checkout branch for release
1919
uses: actions/checkout@v4
2020

21-
- name: Set up Node.js
22-
uses: actions/setup-node@v4
23-
with:
24-
node-version-file: .node-version
25-
26-
- name: Install Dependencies & Configure Git
27-
run: |
28-
npm install
29-
git config user.name "code-snippets-bot"
30-
git config user.email "sre@codesnippets.pro"
31-
3221
- name: Get tag version
3322
id: version
3423
run: |
@@ -42,43 +31,60 @@ jobs:
4231
echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT
4332
else
4433
echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
45-
fi
46-
47-
- name: Create and switch to tag branch
48-
run: |
49-
git checkout -b "tag/v${{ steps.version.outputs.version }}"
34+
fi
5035
36+
changelog:
37+
runs-on: ubuntu-latest
38+
needs: get-version
39+
outputs:
40+
patch: ${{ steps.changelog.outputs.patch }}
41+
steps:
5142
- name: Prepare changelog
52-
if: false
5343
id: changelog
5444
uses: codesnippetspro/.github-private/.github/workflows/changelog.yml@main
5545

56-
- name: Apply changelog
57-
if: false
58-
run: echo "${{ steps.changelog.outputs.patch }}" | git apply -
46+
git-push:
47+
runs-on: ubuntu-latest
48+
needs: [get-version, changelog]
49+
steps:
50+
- name: Checkout branch for release
51+
uses: actions/checkout@v4
52+
53+
- name: Set up Node.js
54+
uses: actions/setup-node@v4
55+
with:
56+
node-version-file: .node-version
57+
58+
- name: Install Dependencies & Configure Git
59+
run: |
60+
npm install
61+
git config user.name "code-snippets-bot"
62+
git config user.email "sre@codesnippets.pro"
63+
64+
- name: Create and switch to tag branch
65+
run: |
66+
git checkout -b "tag/v${{ needs.get-version.outputs.version }}"
5967
6068
- name: Commit changelog update
6169
run: |
70+
echo "${{ needs.changelog.outputs.patch }}" | git apply -
6271
git ls-files --others --modified --exclude-standard | xargs git add
6372
git add -u
64-
git commit -m "chore(changelog): v${{ steps.version.outputs.version }}"
65-
66-
- name: Set new version
67-
run: |
68-
npm --no-git-tag-version version ${{ steps.version.outputs.version }}
73+
git commit -m "chore(changelog): v${{ needs.get-version.outputs.version }}"
6974
7075
- name: Commit version update
7176
run: |
77+
npm --no-git-tag-version version ${{ needs.get-version.outputs.version }}
7278
git ls-files --others --modified --exclude-standard | xargs git add
7379
git add -u
74-
git commit -m "chore(tag): v${{ steps.version.outputs.version }}"
80+
git commit -m "chore(tag): v${{ needs.get-version.outputs.version }}"
7581
76-
- name: Push branch
82+
- name: "Push to branch `tag/v${{ needs.get-version.outputs.version }}`"
7783
run: |
78-
git push --set-upstream origin "tag/v${{ steps.version.outputs.version }}"
84+
git push --set-upstream origin "tag/v${{ needs.get-version.outputs.version }}"
7985
80-
- name: Open pull request
86+
- name: "Open pull request: chore(release): `v${{ needs.get-version.outputs.version }}`"
8187
env:
8288
GH_TOKEN: ${{ secrets.CS_GH_TOKEN }}
8389
run: |
84-
gh pr create --title 'chore(release): `v${{ steps.version.outputs.version }}`' --body 'Release `v${{ steps.version.outputs.version }}`' --base main --head "tag/v${{ steps.version.outputs.version }}"
90+
gh pr create --title 'chore(release): `v${{ needs.get-version.outputs.version }}`' --body 'Release `v${{ needs.get-version.outputs.version }}`' --base main --head "tag/v${{ needs.get-version.outputs.version }}"

0 commit comments

Comments
 (0)