Skip to content

Commit

Permalink
ci: automated github releases (#39)
Browse files Browse the repository at this point in the history
Closes #16
  • Loading branch information
diivi authored Apr 27, 2023
1 parent 09cc988 commit 735fa66
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 0 deletions.
90 changes: 90 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Release

on:
push:
branches:
- main
- beta

jobs:
setup:
name: Set environment variables
runs-on: ubuntu-latest
timeout-minutes: 10
outputs:
DEPLOY_ENVIRONMENT: ${{ steps.env.outputs.DEPLOY_ENVIRONMENT }}
DEPLOY_SUBDOMAIN: ${{ steps.env.outputs.DEPLOY_SUBDOMAIN }}
steps:
- name: "☁️ compute environment variables"
id: env
run: |
echo "::set-output name=DEPLOY_ENVIRONMENT::$([[ ${{ github.ref_name }} == 'main' ]] && echo 'production' || echo ${{ github.ref_name }})"
echo "::set-output name=DEPLOY_SUBDOMAIN::$([[ ${{ github.ref_name }} == 'main' ]] && echo '' || echo '${{ github.ref_name }}.')"
build:
name: Build application
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: "☁️ checkout repository"
uses: actions/checkout@v2

- name: "🔧 setup node"
uses: actions/[email protected]
with:
node-version: 16

- name: "🔧 install npm@latest"
run: npm i -g npm@latest

- name: "📦 install dependencies"
uses: bahmutov/npm-install@v1

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

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

release:
environment:
name: ${{ needs.setup.outputs.DEPLOY_ENVIRONMENT }}
url: https://${{ needs.setup.outputs.DEPLOY_SUBDOMAIN }}insights.opensauced.pizza
name: Semantic release
needs:
- setup
- build
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: "☁️ checkout repository"
uses: actions/checkout@v2
with:
fetch-depth: 0

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

- name: "🚀 release"
id: semantic-release
uses: open-sauced/release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

cleanup:
name: Cleanup actions
needs:
- release
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: "♻️ remove build artifacts"
uses: geekyeggo/delete-artifact@v1
with:
name: |
build
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
"name": "opensauced-browser-extension",
"private": true,
"version": "0.0.0",
"files": [
"dist/**/*"
],
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
Expand Down

0 comments on commit 735fa66

Please sign in to comment.