diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..aebd351c0 --- /dev/null +++ b/.github/workflows/release.yml @@ -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 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0cf14349a..ea1a77de1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -45,5 +45,7 @@ jobs: uses: actions/checkout@v4 - name: Install devbox uses: jetpack-io/devbox-install-action@v0.7.0 + with: + enable-cache: "true" - name: Run linters run: devbox run lefthook run all diff --git a/rules/rules_task/.releaserc b/rules/rules_task/.releaserc index 73a28d766..a5df577a1 100644 --- a/rules/rules_task/.releaserc +++ b/rules/rules_task/.releaserc @@ -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" + } + ] + } + ] ] } diff --git a/rules/rules_task/package.json b/rules/rules_task/package.json index 31dab6a4a..70cecc24e 100644 --- a/rules/rules_task/package.json +++ b/rules/rules_task/package.json @@ -1,5 +1,5 @@ { - "name": "setup", + "name": "rules_task", "version": "1.0.0", "description": "", "main": "index.js", @@ -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", diff --git a/rules/rules_task/pnpm-lock.yaml b/rules/rules_task/pnpm-lock.yaml index 59a9920f4..92f9ca4f5 100644 --- a/rules/rules_task/pnpm-lock.yaml +++ b/rules/rules_task/pnpm-lock.yaml @@ -8,6 +8,9 @@ dependencies: '@semantic-release/commit-analyzer': specifier: 9.0.2 version: 9.0.2(semantic-release@22.0.5) + '@semantic-release/exec': + specifier: ^6.0.3 + version: 6.0.3(semantic-release@22.0.5) '@semantic-release/github': specifier: 8.1.0 version: 8.1.0(semantic-release@22.0.5) @@ -349,6 +352,23 @@ packages: engines: {node: '>=18'} dev: false + /@semantic-release/exec@6.0.3(semantic-release@22.0.5): + resolution: {integrity: sha512-bxAq8vLOw76aV89vxxICecEa8jfaWwYITw6X74zzlO0mc/Bgieqx9kBRz9z96pHectiTAtsCwsQcUyLYWnp3VQ==} + engines: {node: '>=14.17'} + peerDependencies: + semantic-release: '>=18.0.0' + dependencies: + '@semantic-release/error': 3.0.0 + aggregate-error: 3.1.0 + debug: 4.3.4 + execa: 5.1.1 + lodash: 4.17.21 + parse-json: 5.2.0 + semantic-release: 22.0.5 + transitivePeerDependencies: + - supports-color + dev: false + /@semantic-release/github@8.1.0(semantic-release@22.0.5): resolution: {integrity: sha512-erR9E5rpdsz0dW1I7785JtndQuMWN/iDcemcptf67tBNOmBUN0b2YNOgcjYUnBpgRpZ5ozfBHrK7Bz+2ets/Dg==} engines: {node: '>=14.17'} @@ -957,6 +977,21 @@ packages: strip-eof: 1.0.0 dev: false + /execa@5.1.1: + resolution: {integrity: sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==} + engines: {node: '>=10'} + dependencies: + cross-spawn: 7.0.3 + get-stream: 6.0.1 + human-signals: 2.1.0 + is-stream: 2.0.1 + merge-stream: 2.0.0 + npm-run-path: 4.0.1 + onetime: 5.1.2 + signal-exit: 3.0.7 + strip-final-newline: 2.0.0 + dev: false + /execa@8.0.1: resolution: {integrity: sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==} engines: {node: '>=16.17'} @@ -1207,6 +1242,11 @@ packages: - supports-color dev: false + /human-signals@2.1.0: + resolution: {integrity: sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==} + engines: {node: '>=10.17.0'} + dev: false + /human-signals@5.0.0: resolution: {integrity: sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==} engines: {node: '>=16.17.0'} @@ -1316,6 +1356,11 @@ packages: engines: {node: '>=0.10.0'} dev: false + /is-stream@2.0.1: + resolution: {integrity: sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==} + engines: {node: '>=8'} + dev: false + /is-stream@3.0.0: resolution: {integrity: sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} @@ -1578,6 +1623,11 @@ packages: hasBin: true dev: false + /mimic-fn@2.1.0: + resolution: {integrity: sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==} + engines: {node: '>=6'} + dev: false + /mimic-fn@4.0.0: resolution: {integrity: sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==} engines: {node: '>=12'} @@ -1680,6 +1730,13 @@ packages: path-key: 2.0.1 dev: false + /npm-run-path@4.0.1: + resolution: {integrity: sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==} + engines: {node: '>=8'} + dependencies: + path-key: 3.1.1 + dev: false + /npm-run-path@5.1.0: resolution: {integrity: sha512-sJOdmRGrY2sjNTRMbSvluQqg+8X7ZK61yvzBEIDhz4f8z1TZFYABsqjjCBd/0PUNE9M6QDgHJXQkGUEm7Q+l9Q==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} @@ -1771,6 +1828,13 @@ packages: wrappy: 1.0.2 dev: false + /onetime@5.1.2: + resolution: {integrity: sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==} + engines: {node: '>=6'} + dependencies: + mimic-fn: 2.1.0 + dev: false + /onetime@6.0.0: resolution: {integrity: sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==} engines: {node: '>=12'} @@ -2380,6 +2444,11 @@ packages: engines: {node: '>=0.10.0'} dev: false + /strip-final-newline@2.0.0: + resolution: {integrity: sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==} + engines: {node: '>=6'} + dev: false + /strip-final-newline@3.0.0: resolution: {integrity: sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==} engines: {node: '>=12'} diff --git a/rules/rules_task/prepare-release.sh b/rules/rules_task/prepare-release.sh new file mode 100755 index 000000000..6ff34d628 --- /dev/null +++ b/rules/rules_task/prepare-release.sh @@ -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 \ No newline at end of file