-
-
Notifications
You must be signed in to change notification settings - Fork 7
145 lines (117 loc) · 4.42 KB
/
publish-release.yml
File metadata and controls
145 lines (117 loc) · 4.42 KB
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
name: Publish new release to NPM and Docker hub
on:
workflow_dispatch:
inputs:
version:
required: true
type: string
description: Version tag (without leading 'v')
jobs:
checks:
name: Pre-flight-checks
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
- uses: actions/checkout@v3
with:
ref: v${{ inputs.version }}
- name: Check version alignments
run: test "$(jq -r .version package.json)" == "${{ inputs.version }}"
sth-image:
needs: [ checks ]
uses: ./.github/workflows/build-docker-sth.yml
with:
git-revision: v${{ inputs.version }}
runner-image:
needs: [ checks ]
uses: ./.github/workflows/build-docker-runner-node.yml
with:
git-revision: v${{ inputs.version }}
runner-py-image:
needs: [ checks ]
uses: ./.github/workflows/build-docker-runner-python.yml
with:
git-revision: v${{ inputs.version }}
pre-runner-image:
needs: [ checks ]
uses: ./.github/workflows/build-docker-prerunner.yml
with:
git-revision: v${{ inputs.version }}
docker-hub-publish:
name: Push images to Docker Hub
needs: [sth-image, runner-image, runner-py-image, pre-runner-image]
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v3
with:
ref: v${{ inputs.version }}
- name: Get release version number & commit
run: |
echo "COMMIT_ID=$(git rev-parse HEAD)" >> $GITHUB_ENV
echo "RELEASE_VERSION=$(jq -r .version package.json)" >> $GITHUB_ENV
- name: Download docker images
uses: actions/download-artifact@v3
with:
path: docker-images
- name: Unzip docker images
run: |
sudo apt-get install pigz -y
pigz -d docker-images/*/*-docker-image.tar.gz
- name: Load docker images
run: ls -1 docker-images/*/*-docker-image.tar | while read line; do docker load -i $line; done
- name: Tag images with release version
run: |
docker tag scramjetorg/sth:$COMMIT_ID scramjetorg/sth:latest
docker tag scramjetorg/sth:$COMMIT_ID scramjetorg/sth:$RELEASE_VERSION
docker tag scramjetorg/runner:$COMMIT_ID scramjetorg/runner:latest
docker tag scramjetorg/runner:$COMMIT_ID scramjetorg/runner:$RELEASE_VERSION
docker tag scramjetorg/runner-py:$COMMIT_ID scramjetorg/runner-py:latest
docker tag scramjetorg/runner-py:$COMMIT_ID scramjetorg/runner-py:$RELEASE_VERSION
docker tag scramjetorg/pre-runner:$COMMIT_ID scramjetorg/pre-runner:latest
docker tag scramjetorg/pre-runner:$COMMIT_ID scramjetorg/pre-runner:$RELEASE_VERSION
- name: List docker images for inspection
run: docker image ls
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: scramjetci
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Push images to Docker Hub
run: |
docker push scramjetorg/sth:latest
docker push scramjetorg/sth:$RELEASE_VERSION
docker push scramjetorg/runner:latest
docker push scramjetorg/runner:$RELEASE_VERSION
docker push scramjetorg/runner-py:latest
docker push scramjetorg/runner-py:$RELEASE_VERSION
docker push scramjetorg/pre-runner:latest
docker push scramjetorg/pre-runner:$RELEASE_VERSION
npm-publish:
name: Publish packages to NPM
needs: [docker-hub-publish]
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v3
with:
ref: v${{ inputs.version }}
- name: Setup Nodejs 18
uses: actions/setup-node@v3
with:
cache: 'yarn'
node-version: 18
- name: Configure npm registry access
run: |
echo //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }} > ~/.npmrc
echo always-auth=true >> ~/.npmrc
echo @scramjet:registry=https://registry.npmjs.org/ >> ~/.npmrc
chmod 600 ~/.npmrc
- name: Install dependencies
run: yarn install --ignore-engines --frozen-lockfile --prefer-offline --silent
- name: Update saved git hash for marking build version
run: yarn savehash
- name: Build packages in publication mode
run: yarn pack:pub
- name: Publish packages to NPM
run: ./scripts/publish-order-dist-packages.js -s -p