-
Notifications
You must be signed in to change notification settings - Fork 3
122 lines (107 loc) · 5.11 KB
/
bump_version.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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
name: bump_version
on:
# run manually
workflow_dispatch:
inputs:
version:
type: string
description: Version number (e.g. 1.2.3)
required: true
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
bump_version:
runs-on: ubuntu-latest
steps:
- name: Print contexts
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
ENV_CONTEXT: ${{ toJson(env) }}
VARS_CONTEXT: ${{ toJson(vars) }}
JOB_CONTEXT: ${{ toJson(job) }}
STEPS_CONTEXT: ${{ toJson(steps) }}
RUNNER_CONTEXT: ${{ toJson(runner) }}
SECRETS_CONTEXT: ${{ toJson(secrets) }}
STRATEGY_CONTEXT: ${{ toJson(strategy) }}
MATRIX_CONTEXT: ${{ toJson(matrix) }}
NEEDS_CONTEXT: ${{ toJson(needs) }}
INPUTS_CONTEXT: ${{ toJson(inputs) }}
run: |
echo "******************************"
echo "github:" "$GITHUB_CONTEXT"
echo "******************************"
echo "env:" "$ENV_CONTEXT"
echo "******************************"
echo "vars:" "$VARS_CONTEXT"
echo "******************************"
echo "job:" "$JOB_CONTEXT"
echo "******************************"
echo "steps:" "$STEPS_CONTEXT"
echo "******************************"
echo "runner:" "$RUNNER_CONTEXT"
echo "******************************"
echo "secrets:" "$SECRETS_CONTEXT"
echo "******************************"
echo "strategy:" "$STRATEGY_CONTEXT"
echo "******************************"
echo "matrix:" "$MATRIX_CONTEXT"
echo "******************************"
echo "needs:" "$NEEDS_CONTEXT"
echo "******************************"
echo "inputs:" "$INPUTS_CONTEXT"
echo "******************************"
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
- name: Install npm
run: npm i -g npm@$(cat package.json | jq -r .engines.npm)
- run: mkdir -p protocol/cargo-cache
- run: mkdir -p protocol/target
- run: mkdir -p node_modules
- run: mkdir -p ~/.cache/Cypress
- name: Restore cache
uses: actions/cache/restore@v3
with:
path: |
protocol/cargo-cache
protocol/target
node_modules
~/.cache/Cypress
# note that restoring a cache in github is a pain. The trailing '-' matches any string after the '-', therefore 'abc-' would match a cache named 'abc-1234' or 'abc-5678', etc.
# the problem is 'abc-' will not match a cache named 'abc'! So if you're using wildcard cache name selectors like this, you need a field that changes as the suffix to become the wildcard
# here we're setting the key to an unused cache key so it falls back to the wildcard selector in `restore-keys`
key: some-unused-cache-key
restore-keys: |
project-cache-${{ runner.os }}-${{ runner.arch }}-
- run: ls -la ~/.cache/Cypress || true
- run: ls -la protocol/cargo-cache || true
- run: ls -la protocol/target/ink || true
- run: ls -la node_modules || true
- name: Install dependencies
run: npm ci
- name: Build
run: |
npm run build -w @prosopo/scripts
npm run build -w @prosopo/protocol-dev
- name: Bump version
env:
GITHUB_TOKEN: ${{ secrets.PROSOPONATOR_PAT }}
run: |
# make a new branch for the version changes
git switch -c bump-version-${{ github.event.inputs.version }}
# make the version changes
npm run version ${{ github.event.inputs.version }}
# rebuild typechain
npm run build:typechain
# set the author in git
git config user.name "prosoponator[bot]"
git config user.email "[email protected]"
# commit the version changes
git add .
git commit -m "Bump version to ${{ github.event.inputs.version }}"
# push version changes
git push --set-upstream origin bump-version-${{ github.event.inputs.version }}
# create a PR for the release
gh pr create --base main --title "Release ${{ github.event.inputs.version }}" --fill