Skip to content

Commit

Permalink
chore(ci): update ci workflow to use release-please
Browse files Browse the repository at this point in the history
  • Loading branch information
rioam2 committed Jul 1, 2024
1 parent 3cacf36 commit 7a4db3d
Show file tree
Hide file tree
Showing 6 changed files with 165 additions and 24 deletions.
24 changes: 0 additions & 24 deletions .github/workflows/ci.yml

This file was deleted.

50 changes: 50 additions & 0 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: 'pre-release'

# Updates the "latest" tag to the current head when new pushes are
# made to main and updates the "Latest Development Build" release with
# artifacts from this revision

on:
push:
branches: [main]

jobs:
pre-release:
name: 'Pre Release'
runs-on: 'ubuntu-latest'
permissions: 'write-all'

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 8

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'pnpm'

- name: Install
run: pnpm install

- name: Build project
run: npm run build

- name: Archive build artifacts
run: |
zip -r nrk-dual-subs-chrome.zip .output/chrome-mv3/
- name: Create prerelease
uses: marvinpinto/action-automatic-releases@v1.2.1
with:
repo_token: '${{ secrets.GITHUB_TOKEN }}'
title: 'Latest Development Build'
automatic_release_tag: 'latest'
prerelease: true
files: |
nrk-dual-subs-chrome.zip
31 changes: 31 additions & 0 deletions .github/workflows/pullrequest-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Build and test PR

on:
pull_request:
types: [opened, synchronize, reopened]

jobs:
smoke_test:
name: Smoke test
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 8

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'pnpm'

- name: Install
run: pnpm install

- name: Build project
run: npm run build
20 changes: 20 additions & 0 deletions .github/workflows/pullrequest-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Check and prepare PR

on:
pull_request:
types: [opened, synchronize, reopened, edited]

permissions:
checks: 'write'
contents: 'write'
pull-requests: 'read'

jobs:
lint_title:
name: Conventional commit PR title
runs-on: ubuntu-latest

steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63 changes: 63 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: 'Release'

on:
push:
branches: [main]

jobs:
release:
name: 'Release'
runs-on: 'ubuntu-latest'
permissions: 'write-all'

steps:
- uses: googleapis/release-please-action@v4
id: release
with:
release-type: node

- name: Checkout
uses: actions/checkout@v4
if: ${{ steps.release.outputs.release_created }}

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 8

- name: Setup Node
if: ${{ steps.release.outputs.release_created }}
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'pnpm'

- name: Install
if: ${{ steps.release.outputs.release_created }}
run: pnpm install

- name: Build project
if: ${{ steps.release.outputs.release_created }}
run: pnpm build

- name: Archive build artifacts
if: ${{ steps.release.outputs.release_created }}
run: |
zip -r nrk-dual-subs-chrome.zip .output/chrome-mv3/
- name: Upload release artifact
if: ${{ steps.release.outputs.release_created }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ steps.release.outputs.tag_name }} nrk-dual-subs-chrome.zip
- name: Publish Extension
uses: Klemensas/chrome-extension-upload-action@master
with:
refresh-token: ${{ secrets.CHROME_STORE_REFRESH_TOKEN }}
client-id: ${{ secrets.CHROME_STORE_CLIENT_ID }}
client-secret: ${{ secrets.CHROME_STORE_CLIENT_SECRET }}
app-id: ${{ secrets.CHROME_STORE_APP_ID }}
file-name: './nrk-dual-subs-chrome.zip'
publish: true
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20.11.1

0 comments on commit 7a4db3d

Please sign in to comment.