Skip to content

Commit

Permalink
feat: add release workflow (#1)
Browse files Browse the repository at this point in the history
* feat: add release workflow

* fix: temporary remove missing linter function

* docs: update broken badge links
  • Loading branch information
0-vortex committed Aug 3, 2021
1 parent 7dcbe97 commit c1635a4
Show file tree
Hide file tree
Showing 3 changed files with 177 additions and 32 deletions.
29 changes: 0 additions & 29 deletions .github/workflows/development.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,32 +32,3 @@ jobs:

- name: "🚀 static app"
run: npm run build

lint:
name: Code standards
runs-on: ubuntu-latest
steps:
- name: "☁️ checkout repository"
uses: actions/checkout@v2

- name: "🔧 setup node"
uses: actions/setup-node@v2.1.5
with:
node-version: 16

- name: "🔧 setup cache"
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/npm-shrinkwrap.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: "🔧 install npm@7"
run: npm i -g npm@7

- name: "📦 install dependencies"
run: npm ci

- name: "🔍 lint code"
run: npm run lint
174 changes: 174 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
name: "Release"

on:
push:
branches:
- main

jobs:
docker:
name: Build container
runs-on: ubuntu-latest
steps:
- name: "☁️ checkout repository"
uses: actions/checkout@v2

- name: "🔧 setup buildx"
uses: docker/setup-buildx-action@v1

- name: "📦 docker build"
uses: docker/build-push-action@v2
with:
context: .
tags: ${{ github.repository }}:latest
outputs: type=docker,dest=/tmp/docker.tar
push: false

- name: "📂 docker artifacts"
uses: actions/upload-artifact@v2
with:
name: docker
path: /tmp/docker.tar

build:
name: Build application
runs-on: ubuntu-latest
steps:
- name: "☁️ checkout repository"
uses: actions/checkout@v2

- name: "🔧 setup node"
uses: actions/setup-node@v2.1.5
with:
node-version: 16

- name: "🔧 setup cache"
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/npm-shrinkwrap.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: "🔧 install npm@7"
run: npm i -g npm@7

- name: "📦 install dependencies"
run: npm ci

- name: "🚀 static app"
run: npm run build

- name: "📂 production artifacts"
uses: actions/upload-artifact@v2
with:
name: build
path: build

release:
environment:
name: production
url: https://github.com/${{ github.repository }}/releases/tag/v${{ steps.release.outputs.version }}
name: Semantic release
needs:
- docker
- build
runs-on: ubuntu-latest
steps:
- name: "☁️ checkout repository"
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: "🔧 setup node"
uses: actions/setup-node@v2.1.5
with:
node-version: 16

- name: "🔧 setup cache"
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/npm-shrinkwrap.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: "🔧 install npm@7"
run: npm i -g npm@7

- name: "📦 install dependencies"
run: npm ci

- name: "📂 download docker artifacts"
uses: actions/download-artifact@v2
with:
name: docker
path: /tmp

- name: "📦 load tag"
run: |
docker load --input /tmp/docker.tar
docker image ls -a
- name: "📂 download build artifacts"
uses: actions/download-artifact@v2
with:
name: build
path: /tmp/build

- name: "🚀 release"
id: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO_OWNER: ${{ github.repository_owner }}
GIT_AUTHOR_NAME: ${{ github.event.commits[0].author.username }}
GIT_AUTHOR_EMAIL: ${{ github.event.commits[0].author.email }}
GIT_COMMITTER_NAME: ${{ secrets.GIT_COMMITTER_NAME }}
GIT_COMMITTER_EMAIL: ${{ secrets.GIT_COMMITTER_EMAIL }}
run: |
cp -R /tmp/build ./build
npx semantic-release
echo "::set-output name=version::$(cat package.json | jq -r '.version')"
deploy:
name: Deploy to static
needs:
- build
- release
runs-on: ubuntu-latest
steps:
- name: "☁️ checkout repository"
uses: actions/checkout@v2

- name: "📂 download artifacts"
uses: actions/download-artifact@v2
with:
name: build
path: /home/runner/build

- name: "📂 copy artifacts"
run: |
cp -R /home/runner/build .
ls -lahH ./build
- name: "🚀 deploy static"
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build
commit_message: ${{ github.event.head_commit.message }}
enable_jekyll: false
cname: docs.opensauced.pizza

cleanup:
name: Cleanup actions
needs:
- deploy
runs-on: ubuntu-latest
steps:
- name: "♻️ remove build artifacts"
uses: geekyeggo/delete-artifact@v1
with:
name: |
build
docker
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
# docs.opensauced.pizza
> The path to your next Open Source contribution
[![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)
[![Issues](https://img.shields.io/github/issues/open-sauced/explore.opensauced.pizza.svg?style=flat)](https://github.com/open-sauced/explore.opensauced.pizza/issues)
[![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)
[![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)
[![Issues](https://img.shields.io/github/issues/open-sauced/docs.opensauced.pizza.svg?style=flat)](https://github.com/open-sauced/docs.opensauced.pizza/issues)
[![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)
[![Discord](https://img.shields.io/discord/714698561081704529.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.gg/U2peSNf23P)
[![Twitter](https://img.shields.io/twitter/follow/saucedopen?label=Follow&style=social)](https://twitter.com/saucedopen)

Expand Down

0 comments on commit c1635a4

Please sign in to comment.