Skip to content

Commit

Permalink
feat(github action): add releaser
Browse files Browse the repository at this point in the history
  • Loading branch information
cjtim committed Jun 4, 2022
1 parent 0851df5 commit 2d4a70e
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 7 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/build.yaml → .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
# This is a basic workflow to help you get started with Actions
name: build
name: Release
# Controls when the action will run.
on:
push:
branches: [master, main]
pull_request:
tags:
- "**"
workflow_dispatch:

permissions:
contents: write
packages: write
repository-projects: write

jobs:
build:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -40,4 +45,5 @@ jobs:
push: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' }}
tags: |
ghcr.io/${{ github.repository }}:${{ github.sha }}
ghcr.io/${{ github.repository }}:${{ github.ref_name }}
ghcr.io/${{ github.repository }}:latest
29 changes: 29 additions & 0 deletions .github/workflows/releaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Releaser
on:
push:
branches:
- master

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '14'

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Release
run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.PUSH_PAT }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
33 changes: 29 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "be-friends",
"version": "0.1.0",
"version": "0.0.0-development",
"private": true,
"scripts": {
"dev": "next dev",
Expand All @@ -12,7 +12,8 @@
"format": "prettier --write './**/*.{js,jsx,ts,tsx,css,md,json}'",
"prepare": "husky install",
"generate": "prisma generate",
"migrate": "prisma migrate"
"migrate": "prisma migrate",
"semantic-release": "semantic-release"
},
"dependencies": {
"@chakra-ui/icons": "^2.0.1",
Expand All @@ -37,9 +38,33 @@
"eslint-config-prettier": "^8.5.0",
"husky": "^8.0.1",
"prettier": "^2.6.2",
"typescript": "4.6.4"
"typescript": "4.6.4",
"semantic-release": "^19.0.2"
},
"engines": {
"node": ">=14"
}
},
"repository": {
"type": "git",
"url": "https://github.com/cjtim/be-friends.git"
},
"publishConfig": {
"access": "restricted"
},
"release": {
"branches": [
"master"
]
},
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@semantic-release/npm",
{
"npmPublish": false
}
],
"@semantic-release/git"
]
}

0 comments on commit 2d4a70e

Please sign in to comment.