Skip to content

Commit

Permalink
feat: Configure semantic release (#577)
Browse files Browse the repository at this point in the history
* Generate archive for rules_task before publishing

* Setup release job

* Setup pnpm in CI

* Load secret with 1Password
  • Loading branch information
mvgijssel authored Oct 5, 2023
1 parent 8986eed commit d63c497
Show file tree
Hide file tree
Showing 6 changed files with 133 additions and 2 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Release
on:
push:
branches:
- "master"
pull_request:
branches:
- "*"
jobs:
release:
name: Release
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- uses: pnpm/action-setup@v2
with:
version: 8
run_install: |
- cwd: ./rules/rules_task
- name: Load secret
uses: 1password/load-secrets-action@v1
with:
export-env: true
env:
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.ONEPASSWORD_SERVICE_ACCOUNT_TOKEN_DEV }}
GH_TOKEN: "op://vgijssel-dev/semantic-release-setup/credential"

- name: Run release
run: pnpm exec semantic-release
working-directory: ./rules/rules_task
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,7 @@ jobs:
uses: actions/checkout@v4
- name: Install devbox
uses: jetpack-io/[email protected]
with:
enable-cache: "true"
- name: Run linters
run: devbox run lefthook run all
18 changes: 17 additions & 1 deletion rules/rules_task/.releaserc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,22 @@
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/github"
[
"@semantic-release/exec",
{
"prepareCmd": "./prepare-release.sh ${nextRelease.version}"
}
],
[
"@semantic-release/github",
{
"assets": [
{
"path": "*.tar.gz",
"label": "rules_task"
}
]
}
]
]
}
3 changes: 2 additions & 1 deletion rules/rules_task/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "setup",
"name": "rules_task",
"version": "1.0.0",
"description": "",
"main": "index.js",
Expand All @@ -11,6 +11,7 @@
"license": "ISC",
"dependencies": {
"@semantic-release/commit-analyzer": "9.0.2",
"@semantic-release/exec": "^6.0.3",
"@semantic-release/github": "8.1.0",
"@semantic-release/release-notes-generator": "10.0.3",
"semantic-release": "^22.0.5",
Expand Down
69 changes: 69 additions & 0 deletions rules/rules_task/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions rules/rules_task/prepare-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash
set -Eeou pipefail

export VERSION=$1

export PREFIX="rules_task-$VERSION"
export ARCHIVE="rules_task-$VERSION.tar.gz"

git archive --format=tar --prefix=${PREFIX}/ HEAD | gzip > $ARCHIVE

0 comments on commit d63c497

Please sign in to comment.