Skip to content
Open
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
16 changes: 16 additions & 0 deletions .github/workflows/install/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
name: '☑️ Install deps'
description: 'Install dependencies and setup node'

runs:
using: composite
steps:
- name: 🖥️ Setup Node
uses: actions/setup-node@v4
with:
node-version: 20

- name: 🔗 Install Dependencies
shell: bash
run: |
npm ci --no-fund --no-audit --no-progress --ignore-scripts
90 changes: 67 additions & 23 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,30 +1,74 @@
on:
release:
types: [created]
push:
branches:
- main

permissions:
contents: write
packages: write
pull-requests: write
issues: write
deployments: write

concurrency:
group: release-ci-${{ github.repository }}-${{ github.ref }}
cancel-in-progress: true

jobs:
releases-matrix:
name: Release Go Binary
runs-on: ubuntu-latest
strategy:
matrix:
# build and publish in parallel: linux/amd64, linux/arm64, windows/amd64, darwin/amd64, darwin/arm64
goos: [linux, windows, darwin]
goarch: [amd64, arm64]
exclude:
- goarch: arm64
goos: windows
steps:
- uses: actions/checkout@v4
- uses: wangyoucao577/go-release-action@v1
with:
github_token: ${{ secrets.RELEASER_GITHUB_TOKEN }}
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
goversion: "https://go.dev/dl/go1.22.2.linux-amd64.tar.gz"
binary_name: "cz"
extra_files: LICENSE.txt README.md
releases-matrix:
name: 📦 Release Version
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
matrix:
# build and publish in parallel: linux/amd64, linux/arm64, windows/amd64, darwin/amd64, darwin/arm64
goos: [linux, windows, darwin]
goarch: [amd64, arm64]
exclude:
- goarch: arm64
goos: windows
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false

- name: 🖥️ Setup Env
uses: ./.github/workflows/install

- name: 🆚 Extract Next Release Version
id: extract-version
run: |
npx semantic-release --no-ci --dry-run --plugins @semantic-release/commit-analyzer,@semantic-release/release-notes-generator > output.txt

NEXT_VERSION=$(cat output.txt \
| grep "The next release version is" \
| node -e "console.log(require('fs').readFileSync(0, 'utf-8').match(/The next release version is (\d+\.\d+\.\d+(-beta\.\d+)?)/)?.[1] ?? '')")

echo "version=$NEXT_VERSION" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.RELEASER_GITHUB_TOKEN }}

- uses: wangyoucao577/go-release-action@v1
if: steps.extract-version.outputs.version != ''
with:
github_token: ${{ secrets.RELEASER_GITHUB_TOKEN }}
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
goversion: 'https://go.dev/dl/go1.22.2.linux-amd64.tar.gz'
binary_name: 'cz'
extra_files: LICENSE.txt README.md

# enable this after debug the release process - update assets under the `.releaserc` file
- name: 🚀 Release
if: steps.extract-version.outputs.version != '' && false
env:
# This is required to make semantic-release work with GitHub Actions
GITHUB_TOKEN: ${{ secrets.RELEASER_GITHUB_TOKEN }}
GIT_AUTHOR_NAME: github-bot
GIT_AUTHOR_EMAIL: github-bot@gmail.com
GIT_COMMITTER_NAME: github-bot
GIT_COMMITTER_EMAIL: github-bot@gmail.com
run: |
npx semantic-release
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

# Dependency directories (remove the comment below to include it)
# vendor/
node_modules

# Go workspace file
go.work
Expand Down
1 change: 1 addition & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx --no -- commitlint --edit ${1}
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
registry=https://registry.npmjs.org/

46 changes: 46 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"$schema": "https://json.schemastore.org/semantic-release.json",
"repositoryUrl": "https://github.com/ozkatz/cloudzip.git",
"branches": [
"+([0-9])?(.{+([0-9]),x}).x",
"master",
{
"name": "beta",
"prerelease": true
}
],
"tagFormat": "v${version}",
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@semantic-release/changelog",
{
"changelogFile": "CHANGELOG.md"
}
],
[
"@semantic-release/git",
{
"assets": [
"package.json",
"package-lock.json",
"CHANGELOG.md"
],
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
],
[
"@semantic-release/github",
{
"assets": [
{
"path": "./pack.zip",
"label": "cli-v${nextRelease.version}.zip",
"name": "cli-v${nextRelease.version}.zip"
}
]
}
]
]
}
File renamed without changes.
1 change: 1 addition & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = { extends: ['@commitlint/config-conventional'] }
Loading