-
Notifications
You must be signed in to change notification settings - Fork 41
61 lines (48 loc) · 1.83 KB
/
release-commit.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
name: Release commit
on:
release:
types: [published]
env:
PR_BRANCH_NAME: release-${{ github.event.release.tag_name }}
PRE_RELEASE: ${{ github.event.release.prerelease}}
jobs:
release-commit-pr:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.repository.default_branch }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
registry-url: https://registry.npmjs.org/
- name: Install dependencies
run: npm ci
- name: Run unit tests
run: npm test
- name: Run integration tests
run: npm run if-check -- -d manifests/outputs
- name: Initialize git user email
run: git config --global user.email "${{ vars.RELEASE_USER_EMAIL }}"
- name: Initialize git user name
run: git config --global user.name "Release commit workflow"
- name: Fetch latest changes
run: git fetch --all
- name: Checkout to release branch if it's not a pre-release
if: ${{!env.PRE_RELEASE}}
run: git checkout ${{ vars.RELEASE_BRANCH_NAME }}
- name: Checkout to current release branch to create PR from
run: |
git checkout -b $PR_BRANCH_NAME
git push --set-upstream origin $PR_BRANCH_NAME
- name: Bump version and push changes using release-it
run: |
npm run release -- --ci ${{ github.event.release.tag_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create pull request
run: gh pr create -B ${{ vars.RELEASE_BRANCH_NAME }} -H $PR_BRANCH_NAME --title "Release ${{github.event.release.tag_name}}" --body "${{github.event.release.body}}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}