Skip to content

Commit c1635a4

Browse files
authored
feat: add release workflow (#1)
* feat: add release workflow * fix: temporary remove missing linter function * docs: update broken badge links
1 parent 7dcbe97 commit c1635a4

File tree

3 files changed

+177
-32
lines changed

3 files changed

+177
-32
lines changed

.github/workflows/development.yml

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -32,32 +32,3 @@ jobs:
3232

3333
- name: "🚀 static app"
3434
run: npm run build
35-
36-
lint:
37-
name: Code standards
38-
runs-on: ubuntu-latest
39-
steps:
40-
- name: "☁️ checkout repository"
41-
uses: actions/checkout@v2
42-
43-
- name: "🔧 setup node"
44-
uses: actions/[email protected]
45-
with:
46-
node-version: 16
47-
48-
- name: "🔧 setup cache"
49-
uses: actions/cache@v2
50-
with:
51-
path: ~/.npm
52-
key: ${{ runner.os }}-node-${{ hashFiles('**/npm-shrinkwrap.json') }}
53-
restore-keys: |
54-
${{ runner.os }}-node-
55-
56-
- name: "🔧 install npm@7"
57-
run: npm i -g npm@7
58-
59-
- name: "📦 install dependencies"
60-
run: npm ci
61-
62-
- name: "🔍 lint code"
63-
run: npm run lint

.github/workflows/release.yml

Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
name: "Release"
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
docker:
10+
name: Build container
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: "☁️ checkout repository"
14+
uses: actions/checkout@v2
15+
16+
- name: "🔧 setup buildx"
17+
uses: docker/setup-buildx-action@v1
18+
19+
- name: "📦 docker build"
20+
uses: docker/build-push-action@v2
21+
with:
22+
context: .
23+
tags: ${{ github.repository }}:latest
24+
outputs: type=docker,dest=/tmp/docker.tar
25+
push: false
26+
27+
- name: "📂 docker artifacts"
28+
uses: actions/upload-artifact@v2
29+
with:
30+
name: docker
31+
path: /tmp/docker.tar
32+
33+
build:
34+
name: Build application
35+
runs-on: ubuntu-latest
36+
steps:
37+
- name: "☁️ checkout repository"
38+
uses: actions/checkout@v2
39+
40+
- name: "🔧 setup node"
41+
uses: actions/[email protected]
42+
with:
43+
node-version: 16
44+
45+
- name: "🔧 setup cache"
46+
uses: actions/cache@v2
47+
with:
48+
path: ~/.npm
49+
key: ${{ runner.os }}-node-${{ hashFiles('**/npm-shrinkwrap.json') }}
50+
restore-keys: |
51+
${{ runner.os }}-node-
52+
53+
- name: "🔧 install npm@7"
54+
run: npm i -g npm@7
55+
56+
- name: "📦 install dependencies"
57+
run: npm ci
58+
59+
- name: "🚀 static app"
60+
run: npm run build
61+
62+
- name: "📂 production artifacts"
63+
uses: actions/upload-artifact@v2
64+
with:
65+
name: build
66+
path: build
67+
68+
release:
69+
environment:
70+
name: production
71+
url: https://github.com/${{ github.repository }}/releases/tag/v${{ steps.release.outputs.version }}
72+
name: Semantic release
73+
needs:
74+
- docker
75+
- build
76+
runs-on: ubuntu-latest
77+
steps:
78+
- name: "☁️ checkout repository"
79+
uses: actions/checkout@v2
80+
with:
81+
fetch-depth: 0
82+
83+
- name: "🔧 setup node"
84+
uses: actions/[email protected]
85+
with:
86+
node-version: 16
87+
88+
- name: "🔧 setup cache"
89+
uses: actions/cache@v2
90+
with:
91+
path: ~/.npm
92+
key: ${{ runner.os }}-node-${{ hashFiles('**/npm-shrinkwrap.json') }}
93+
restore-keys: |
94+
${{ runner.os }}-node-
95+
96+
- name: "🔧 install npm@7"
97+
run: npm i -g npm@7
98+
99+
- name: "📦 install dependencies"
100+
run: npm ci
101+
102+
- name: "📂 download docker artifacts"
103+
uses: actions/download-artifact@v2
104+
with:
105+
name: docker
106+
path: /tmp
107+
108+
- name: "📦 load tag"
109+
run: |
110+
docker load --input /tmp/docker.tar
111+
docker image ls -a
112+
113+
- name: "📂 download build artifacts"
114+
uses: actions/download-artifact@v2
115+
with:
116+
name: build
117+
path: /tmp/build
118+
119+
- name: "🚀 release"
120+
id: release
121+
env:
122+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
123+
REPO_OWNER: ${{ github.repository_owner }}
124+
GIT_AUTHOR_NAME: ${{ github.event.commits[0].author.username }}
125+
GIT_AUTHOR_EMAIL: ${{ github.event.commits[0].author.email }}
126+
GIT_COMMITTER_NAME: ${{ secrets.GIT_COMMITTER_NAME }}
127+
GIT_COMMITTER_EMAIL: ${{ secrets.GIT_COMMITTER_EMAIL }}
128+
run: |
129+
cp -R /tmp/build ./build
130+
npx semantic-release
131+
echo "::set-output name=version::$(cat package.json | jq -r '.version')"
132+
133+
deploy:
134+
name: Deploy to static
135+
needs:
136+
- build
137+
- release
138+
runs-on: ubuntu-latest
139+
steps:
140+
- name: "☁️ checkout repository"
141+
uses: actions/checkout@v2
142+
143+
- name: "📂 download artifacts"
144+
uses: actions/download-artifact@v2
145+
with:
146+
name: build
147+
path: /home/runner/build
148+
149+
- name: "📂 copy artifacts"
150+
run: |
151+
cp -R /home/runner/build .
152+
ls -lahH ./build
153+
154+
- name: "🚀 deploy static"
155+
uses: peaceiris/actions-gh-pages@v3
156+
with:
157+
github_token: ${{ secrets.GITHUB_TOKEN }}
158+
publish_dir: ./build
159+
commit_message: ${{ github.event.head_commit.message }}
160+
enable_jekyll: false
161+
cname: docs.opensauced.pizza
162+
163+
cleanup:
164+
name: Cleanup actions
165+
needs:
166+
- deploy
167+
runs-on: ubuntu-latest
168+
steps:
169+
- name: "♻️ remove build artifacts"
170+
uses: geekyeggo/delete-artifact@v1
171+
with:
172+
name: |
173+
build
174+
docker

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
# docs.opensauced.pizza
55
> The path to your next Open Source contribution
66
7-
[![Commits](https://img.shields.io/github/commit-activity/w/open-sauced/explore.opensauced.pizza?style=flat)](https://github.com/open-sauced/explore.opensauced.pizza/pulse)
8-
[![Issues](https://img.shields.io/github/issues/open-sauced/explore.opensauced.pizza.svg?style=flat)](https://github.com/open-sauced/explore.opensauced.pizza/issues)
9-
[![Releases](https://img.shields.io/github/v/release/open-sauced/explore.opensauced.pizza.svg?style=flat)](https://github.com/open-sauced/explore.opensauced.pizza/releases)
7+
[![Commits](https://img.shields.io/github/commit-activity/w/open-sauced/docs.opensauced.pizza?style=flat)](https://github.com/open-sauced/docs.opensauced.pizza/pulse)
8+
[![Issues](https://img.shields.io/github/issues/open-sauced/docs.opensauced.pizza.svg?style=flat)](https://github.com/open-sauced/docs.opensauced.pizza/issues)
9+
[![Releases](https://img.shields.io/github/v/release/open-sauced/docs.opensauced.pizza.svg?style=flat)](https://github.com/open-sauced/docs.opensauced.pizza/releases)
1010
[![Discord](https://img.shields.io/discord/714698561081704529.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.gg/U2peSNf23P)
1111
[![Twitter](https://img.shields.io/twitter/follow/saucedopen?label=Follow&style=social)](https://twitter.com/saucedopen)
1212

0 commit comments

Comments
 (0)