-
Notifications
You must be signed in to change notification settings - Fork 12
94 lines (84 loc) · 3.02 KB
/
release-on-semver-tag.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
name: Release on semver tag
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
jobs:
release:
env:
tag: ${{ github.ref_name }}
tag_ref: ${{ github.ref }}
release_tar_name: elements-${{ github.ref_name }}.tar.gz
base_branch: "dev"
base_branch_ref: "origin/dev"
dist_branch: dist/frontend
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Pull main branch
run: |
git fetch origin $base_branch
- name: Are we on the tip of the main branch?
run: |
set -e -x
git fetch origin
exec >> $GITHUB_ENV
if [ "$(git rev-parse $tag_ref)" = "$(git rev-parse $base_branch_ref)" ]; then
echo is_uptodate=true
else
echo is_uptodate=false
fi
- uses: andymckay/[email protected]
if: ${{ env.is_uptodate == 'false' }}
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: '14'
- name: Install dependencies
run: yarn --frozen-lockfile --network-timeout 1000000
- run: yarn dist
- name: Pluck gh-pages/ directory out of dist/
run: |
mkdir gh-pages
(cd dist; tar --exclude package.json -clf - .) | \
(cd gh-pages; tar xpvf -)
- uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./gh-pages
- name: Pluck frontend/ directory out of dist/
run: |
mkdir frontend
(cd dist; tar --exclude components --exclude docs \
--exclude images/styleguide --exclude index.html \
--exclude "reader.*" -clf - .) | \
(cd frontend; tar xpvf -)
- name: Deploy to “dist/frontend” branch
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./frontend
publish_branch: ${{ env.dist_branch }}
- name: Pluck release/ out of dist/
# The placement scheme is that of https://www.npmjs.com/package/epfl-theme-elements
run: |
set -e -x
mkdir -p release/dist/icons release/dist/css release/dist/js
cp $(find dist/ -name icons -prune -false -o -name "*.svg") \
dist/icons/* \
dist/favicons/*.png dist/favicons/*.ico \
release/dist/icons/
cp dist/package.json release/
cp dist/css/elements.min.css release/dist/css/elements.min.css
cp dist/js/elements.min.js release/dist/js/elements.min.js
- name: Create release package
# The placement scheme is that of https://www.npmjs.com/package/epfl-theme-elements
run: |
set -e -x
tar -Crelease -zcf $release_tar_name .
- uses: "marvinpinto/[email protected]"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
files: |
${{ env.release_tar_name }}