Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: automated github releases #39

Merged
merged 2 commits into from
Apr 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
bdougie marked this conversation as resolved.
Show resolved Hide resolved
- 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