Skip to content

Commit 30d7387

Browse files
authored
chore(ci): automatically upload binaries to github release's (#73)
What this pull request does is publish the latest binaries to the `canary` git tag release. GitHub can house release assets per tag, or per release issue. Until we hit something stable, we should publish the latest binaries to the `canary` tag. There is an additional change, in that the release action will only run if the `test` workflow succeeded. I also got rid of the "release tag" or issue creation flows, probably we can explore that closer to when we wanna start tagging properly. I've found that using [git tags to "trigger" releases](https://github.com/maraisr/dldr/blob/614317540d4982b779a3756a560a96b74ec2060f/.github/workflows/ci.yml#L31), work really well. But given we embed the css spec in the binary, id probably like to see us split the "db" from the cli, such that we do not need a new NPM/extension release just to capture new specs. And instead do something like caniuse, in that the db is a separate binary. But lets discuss this some other time, there are pros in a self contained NPM too. For now, this will publish the binaries to a canary release, we can then use to power things like a Zed extension.
1 parent 12d55ef commit 30d7387

File tree

1 file changed

+46
-10
lines changed

1 file changed

+46
-10
lines changed

.github/workflows/release.yml

+46-10
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# mostly copied from https://raw.githubusercontent.com/web-infra-dev/oxc/main/.github/workflows/release_cli.yml
22
name: release
33
on:
4-
push:
5-
branches: ["main"]
6-
release:
7-
types: [created]
4+
workflow_run:
5+
workflows: [test]
6+
types: [completed]
7+
branches: [main]
88
workflow_dispatch:
99
concurrency:
1010
group: "release"
@@ -13,7 +13,29 @@ permissions:
1313
contents: read
1414
id-token: write
1515
jobs:
16+
tag:
17+
runs-on: ubuntu-latest
18+
needs: [build]
19+
steps:
20+
- uses: actions/checkout@v4
21+
- name: Tag
22+
run: |
23+
git config user.name "github-actions[bot]"
24+
git config user.email "github-actions[bot]@users.noreply.github.com"
25+
git tag -fa canary -m "Latest Continuous Release" ${GITHUB_SHA}
26+
git push --force-with-lease origin canary
27+
1628
build:
29+
if: |
30+
${{
31+
github.event_name == 'workflow_dispatch' ||
32+
(
33+
github.event.workflow_run.conclusion == 'success' &&
34+
github.repository_owner == 'keithamus' &&
35+
github.ref_name == 'main'
36+
)
37+
}}
38+
1739
strategy:
1840
matrix:
1941
include:
@@ -84,11 +106,10 @@ jobs:
84106
85107
deploy:
86108
env:
87-
TAG_NAME: ${{ github.event.release.tag_name || format('0.0.0-canary.{0}', github.SHA) }}
88-
DIST_TAG: ${{ github.event.release.tag_name && 'latest' || 'canary' }}
109+
TAG_NAME: ${{ format('0.0.0-canary.{0}', github.SHA) }}
110+
DIST_TAG: canary
89111
runs-on: ubuntu-latest
90-
needs:
91-
- build
112+
needs: [build]
92113
steps:
93114
- run: echo "TAG_NAME=$TAG_NAME"; echo "DIST_TAG=$DIST_TAG"
94115
- uses: actions/checkout@v4
@@ -100,8 +121,7 @@ jobs:
100121
cache: "npm"
101122
- name: Download Artifacts
102123
uses: actions/download-artifact@v4
103-
- name: Move
104-
run: mv binary-*/* packages/hdx/bin && chmod +x packages/hdx/bin/*
124+
- run: cp binary-*/* packages/hdx/bin && chmod +x packages/hdx/bin/*
105125
- run: tree
106126
- run: npm i
107127
working-directory: ./packages/hdx
@@ -111,3 +131,19 @@ jobs:
111131
working-directory: ./packages/hdx
112132
env:
113133
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
134+
- name: Update Release
135+
uses: softprops/action-gh-release@v2
136+
with:
137+
name: Canary
138+
prerelease: true
139+
tag_name: canary
140+
target_commitish: ${{ github.sha }}
141+
files: binary-*/*
142+
token: ${{ secrets.GITHUB_TOKEN }}
143+
body: |
144+
This release is automatically built and generated on every commit to main that passes tests.
145+
146+
And is currently published to npm:
147+
```shell
148+
npm add hdx@$DIST_TAG
149+
```

0 commit comments

Comments
 (0)