-
Notifications
You must be signed in to change notification settings - Fork 48
99 lines (81 loc) · 3.25 KB
/
stable-push.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
name: Push Stable
on:
workflow_dispatch: {}
# Declare default permissions as read only.
permissions: read-all
jobs:
# check for changed packages
verify-packages:
name: Verify changed packages
permissions:
id-token: write
contents: write
actions: read
runs-on: ubuntu-22.04
outputs:
changed_packages: ${{ steps.tag_check_changes.outputs.changed_packages }}
latest_tag: ${{ steps.tag_check_changes.outputs.latest_tag }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@8ca2b8b2ece13480cda6dacd3511b49857a23c09 # v2.5.1
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Prepare pre-requisites
uses: ./.github/actions/prepare
- name: Install deps
run: yarn install-deps
- name: Style
run: yarn style
- name: Build
run: yarn nx-build-skip-cache
- name: Test
run: yarn nx-test-skip-cache
- name: Get latest git tag and verify package changes
id: tag_check_changes
run: |
git fetch --prune --unshallow --tags
latest_tag=$(git describe --tags --abbrev=0 --match "v*")
echo "latest_tag=$latest_tag" >> $GITHUB_OUTPUT
changed_packages=$(lerna changed --json | jq -r 'length')
echo "changed_packages=${changed_packages:-0}" >> $GITHUB_OUTPUT
# Commit & Push to branch
commit-push:
name: Commit and push changes
permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the
# added or changed files to the repository.
contents: write
needs: verify-packages
if: needs.verify-packages.outputs.changed_packages > 0
runs-on: ubuntu-22.04
steps:
- name: Harden Runner
uses: step-security/harden-runner@8ca2b8b2ece13480cda6dacd3511b49857a23c09 # v2.5.1
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Update stable version
run: |
yarn versionup:stableminor && ./hack/cross-dependency.sh
- name: Commit changes
id: update_version
run: |
TAG_NAME=$(node -p "require('./lerna.json').version")
echo "stable_version=v$TAG_NAME" >> $GITHUB_OUTPUT
- name: Raise PR to the branch
id: stable-pr
uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38
with:
commit-message: "🤖 Update version to ${{ steps.update_version.outputs.stable_version }}"
branch: 'update-version/${{ steps.update_version.outputs.stable_version }}'
title: "🤖 [Automated Pr] Update version to ${{ steps.update_version.outputs.stable_version }}"
committer: svc-gh-is-01 <[email protected]>
author: svc-gh-is-01 <[email protected]>
delete-branch: true
body: |
This PR updates the version to ${{ steps.update_version.outputs.stable_version }}.
Please review and merge this PR if it looks good.
This is an automated PR created by github actions.