This repository has been archived by the owner on Mar 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
91 lines (76 loc) · 2.66 KB
/
release-publish.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
name: Publish
on:
release:
types: [ published, prereleased ]
jobs:
docker:
name: Docker
runs-on: ubuntu-latest
environment: Docker Release
steps:
- uses: actions/github-script@9ac08808f993958e9de277fe43a64532a609130e
id: version
with:
script: |
const semver = context.ref.replace('refs/tags/v', '')
if (semver.match(/^[0-9]+\.[0-9]+\.[0-9]+$/)) {
return semver
}
throw new Error('not semver')
result-encoding: string
- name: Set up QEMU
uses: docker/setup-qemu-action@27d0a4f181a40b142cce983c5393082c365d1480
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@94ab11c41e45d028884a99163086648e898eed25
- name: Login to GitHub Container Registry
uses: docker/login-action@6af3c118c8376c675363897acf1757f7a9be6583
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@7f9d37fa544684fb73bfe4835ed7214c255ce02b
with:
push: true
platforms: |
linux/amd64
linux/arm64
tags: |
ghcr.io/defich/playground:latest
ghcr.io/defich/playground:${{ steps.version.outputs.result }}
npm:
name: NPM
runs-on: ubuntu-latest
environment: NPM Release
steps:
- uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
- uses: actions/setup-node@9ced9a43a244f3ac94f13bfd896db8c8f30da67a
with:
node-version: 16
- uses: actions/github-script@9ac08808f993958e9de277fe43a64532a609130e
id: version
with:
script: |
const semver = context.ref.replace('refs/tags/v', '')
if (semver.match(/^[0-9]+\.[0-9]+\.[0-9]+$/)) {
return semver
}
throw new Error('not semver')
result-encoding: string
- run: npm ci
- run: npm run packages:build
- run: npm run packages:version ${{ steps.version.outputs.result }}
- name: Publish Next
if: github.event.release.prerelease
run: |
npm config set //registry.npmjs.org/:_authToken=$NPM_AUTH_TOKEN
npm run packages:publish:next
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
- name: Publish Latest
if: "!github.event.release.prerelease"
run: |
npm config set //registry.npmjs.org/:_authToken=$NPM_AUTH_TOKEN
npm run packages:publish:latest
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}