-
-
Notifications
You must be signed in to change notification settings - Fork 2
133 lines (115 loc) · 4.53 KB
/
release.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
123
124
125
126
127
128
129
130
131
132
133
name: Test Suite
on:
push:
branches:
- master
jobs:
build:
name: 'Release'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
name: Checkout Code
- uses: actions/setup-node@v1
name: Setup Node.js
with:
node-version: '14'
- uses: actions/cache@v2
name: Establish Docker Cache
id: cache
with:
path: docker-cache
key: ${{ runner.os }}-docker-${{ github.sha }}
restore-keys: |
${{ runner.os }}-docker-
- name: Load cached Docker layers
run: |
if [ -d "docker-cache" ]; then
cat docker-cache/x* > my-image.tar
docker load < my-image.tar
rm -rf docker-cache
fi
- name: Setup Build Tooling
id: setup
run: |
base=$(curl -L -s 'https://registry.hub.docker.com/v2/repositories/author/dev-base/tags?page_size=1'|jq '."results"[]["name"]')
base=$(sed -e 's/^"//' -e 's/"$//' <<<"$base")
echo Retrieving author/dev/dev-base:$base
docker pull author/dev-base:$base
deno=$(curl -L -s 'https://registry.hub.docker.com/v2/repositories/author/dev-deno/tags?page_size=1'|jq '."results"[]["name"]')
deno=$(sed -e 's/^"//' -e 's/"$//' <<<"$deno")
echo Retrieving author/dev/dev-deno:$deno
docker pull author/dev-deno:$deno
browser=$(curl -L -s 'https://registry.hub.docker.com/v2/repositories/author/dev-browser/tags?page_size=1'|jq '."results"[]["name"]')
browser=$(sed -e 's/^"//' -e 's/"$//' <<<"$browser")
echo Retrieving author/dev/dev-browser:$browser
docker pull author/dev-browser:$browser
node=$(curl -L -s 'https://registry.hub.docker.com/v2/repositories/author/dev-node/tags?page_size=1'|jq '."results"[]["name"]')
node=$(sed -e 's/^"//' -e 's/"$//' <<<"$node")
echo Retrieving author/dev/dev-node:$node
docker pull author/dev-node:$node
# node -e "const p=new Set(Object.keys(require('./package.json').peerDependencies));p.delete('@author.io/dev');console.log('npm i ' + Array.from(p).join(' '))"
version=$(npm show @author.io/dev version)
echo $version
npm i -g @author.io/dev@$version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Test
if: success()
run: |
dev -v
npm run ci
- name: Tag
id: autotagger
if: success()
uses: butlerlogic/action-autotag@stable
with:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
# If the new version/tag is a pre-release (i.e. 1.0.0-beta.1), create
# an environment variable indicating it is a prerelease.
- name: Pre-release
if: steps.autotagger.outputs.tagname != ''
run: |
if [[ "${{ steps.autotagger.output.version }}" == *"-"* ]]; then echo "::set-env IS_PRERELEASE=true";else echo "::set-env IS_PRERELEASE=''";fi
- name: Release
id: create_release
if: steps.autotagger.outputs.tagname != ''
uses: actions/create-release@v1.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.autotagger.outputs.tagname }}
release_name: ${{ steps.autotagger.outputs.tagname }}
body: ${{ steps.autotagger.outputs.tagmessage }}
draft: false
prerelease: env.IS_PRERELEASE != ''
# Build tarballs of the module code.
- name: Build Release Artifacts
id: build_release
if: steps.create_release.outputs.id != ''
run: |
dev build --pack
cp -rf .dist ./dist
# Upload tarballs to the release.
- name: Upload Release Artifacts
uses: AButler/upload-release-assets@v2.0
if: steps.create_release.outputs.id != ''
with:
files: '.dist/*.tar.gz'
repo-token: ${{ secrets.GITHUB_TOKEN }}
release-tag: ${{ steps.autotagger.outputs.tagname }}
- name: Publish to npm
id: publish_npm
if: steps.autotagger.outputs.tagname != ''
uses: author/action-publish@stable
with:
scan: ./dist
env:
REGISTRY_TOKEN: ${{ secrets.NPM_REGISTRY_TOKEN }}
- name: Rollback Release
if: failure() && steps.create_release.outputs.id != ''
uses: author/action-rollback@stable
with:
tag: ${{ steps.autotagger.outputs.tagname }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}