Skip to content

Commit 37c06d7

Browse files
authored
Merge pull request #409 from Extra-Chill/fix-release-asset-trigger
ci: trigger release-asset build on release.published
2 parents 74ff03f + a3452f2 commit 37c06d7

2 files changed

Lines changed: 67 additions & 48 deletions

File tree

.github/workflows/homeboy.yml

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -25,51 +25,3 @@ jobs:
2525
expected-commands: audit,lint,test
2626
autofix: 'false'
2727
secrets: inherit
28-
29-
build-release-asset:
30-
if: needs.homeboy.outputs.released == 'true'
31-
needs: [homeboy]
32-
runs-on: ubuntu-latest
33-
permissions:
34-
contents: write
35-
steps:
36-
- uses: actions/checkout@v4
37-
with:
38-
ref: ${{ needs.homeboy.outputs.release-tag }}
39-
40-
- uses: shivammathur/setup-php@v2
41-
with:
42-
php-version: '8.3'
43-
tools: composer:v2
44-
45-
- run: composer install --no-dev --optimize-autoloader --prefer-dist --no-interaction
46-
47-
- name: Build plugin ZIP
48-
run: |
49-
mkdir -p dist/data-machine-code
50-
rsync -a ./ dist/data-machine-code/ \
51-
--exclude='.git' \
52-
--exclude='.github' \
53-
--exclude='.claude' \
54-
--exclude='.datamachine' \
55-
--exclude='AGENTS.md' \
56-
--exclude='dist' \
57-
--exclude='docs' \
58-
--exclude='node_modules' \
59-
--exclude='tests' \
60-
--exclude='*.zip' \
61-
--exclude='*.tar.gz' \
62-
--exclude='*.log' \
63-
--exclude='*.tmp' \
64-
--exclude='*.temp' \
65-
--exclude='*.cache' \
66-
--exclude='*.bak' \
67-
--exclude='*.backup' \
68-
--exclude='phpstan-baseline.neon' \
69-
--exclude='phpunit.xml*'
70-
cd dist
71-
zip -r data-machine-code.zip data-machine-code
72-
73-
- run: gh release upload "${{ needs.homeboy.outputs.release-tag }}" dist/data-machine-code.zip --clobber
74-
env:
75-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Release asset
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
inputs:
8+
tag:
9+
description: 'Existing release tag to (re)build and upload an asset for.'
10+
required: true
11+
12+
permissions:
13+
contents: write
14+
15+
jobs:
16+
build-release-asset:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Resolve release tag
20+
id: tag
21+
run: |
22+
if [ -n "${{ github.event.release.tag_name }}" ]; then
23+
echo "tag=${{ github.event.release.tag_name }}" >> "$GITHUB_OUTPUT"
24+
else
25+
echo "tag=${{ github.event.inputs.tag }}" >> "$GITHUB_OUTPUT"
26+
fi
27+
28+
- uses: actions/checkout@v4
29+
with:
30+
ref: ${{ steps.tag.outputs.tag }}
31+
32+
- uses: shivammathur/setup-php@v2
33+
with:
34+
php-version: '8.3'
35+
tools: composer:v2
36+
37+
- run: composer install --no-dev --optimize-autoloader --prefer-dist --no-interaction
38+
39+
- name: Build plugin ZIP
40+
run: |
41+
mkdir -p dist/data-machine-code
42+
rsync -a ./ dist/data-machine-code/ \
43+
--exclude='.git' \
44+
--exclude='.github' \
45+
--exclude='.claude' \
46+
--exclude='.datamachine' \
47+
--exclude='AGENTS.md' \
48+
--exclude='dist' \
49+
--exclude='docs' \
50+
--exclude='node_modules' \
51+
--exclude='tests' \
52+
--exclude='*.zip' \
53+
--exclude='*.tar.gz' \
54+
--exclude='*.log' \
55+
--exclude='*.tmp' \
56+
--exclude='*.temp' \
57+
--exclude='*.cache' \
58+
--exclude='*.bak' \
59+
--exclude='*.backup' \
60+
--exclude='phpstan-baseline.neon' \
61+
--exclude='phpunit.xml*'
62+
cd dist
63+
zip -r data-machine-code.zip data-machine-code
64+
65+
- run: gh release upload "${{ steps.tag.outputs.tag }}" dist/data-machine-code.zip --clobber
66+
env:
67+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)