-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from OffchainLabs/test-build-action
set up workflow to support external repo use
- Loading branch information
Showing
4 changed files
with
90 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: build-unclog | ||
description: builds the unclog binary from source | ||
|
||
inputs: | ||
artifact-name: | ||
required: false | ||
type: string | ||
outputs: | ||
artifact-name: | ||
description: "name of uploaded artifact" | ||
value: ${{ steps.artifact-namer.outputs.artifact-name }} | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: '1.22' | ||
|
||
- name: Build | ||
shell: bash | ||
run: go build -o unclog -v . | ||
|
||
- name: Default binary name | ||
if: ${{ inputs.artifact-name != '' }} | ||
shell: bash | ||
run: | | ||
echo "UNCLOG_BINARY_NAME={{ $inputs.artifact-name }}" >> ${GITHUB_ENV} | ||
- name: Scoped name in PR | ||
if: ${{ inputs.artifact-name == '' && github.event_name == 'pull_request' }} | ||
shell: bash | ||
run: | | ||
echo "UNCLOG_BINARY_NAME=unclog-${{ github.event.pull_request.head.sha }}" >> ${GITHUB_ENV} | ||
- name: Scoped name on push | ||
if: ${{ inputs.artifact-name == '' && github.event_name == 'push' }} | ||
shell: bash | ||
run: | | ||
echo "UNCLOG_BINARY_NAME=unclog-${GITHUB_SHA}" >> ${GITHUB_ENV} | ||
- name: Set artifact-name output parameter | ||
id: artifact-namer | ||
shell: bash | ||
run: | | ||
echo "artifact-name=${UNCLOG_BINARY_NAME}" >> "$GITHUB_OUTPUT" | ||
- name: Upload unclog binary | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ steps.artifact-namer.outputs.artifact-name }} | ||
path: unclog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: main-artifact-refresh | ||
description: "ensures there is always an unclog artifact available, building monthly (less than 90 day retention period) or when PRs merge to main" | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- closed | ||
schedule: | ||
- cron: "0 0 1 * *" # run first day of month | ||
|
||
jobs: | ||
refresh-unclog-binary: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout source code | ||
uses: actions/checkout@v4 | ||
|
||
- name: build-unclog | ||
uses: ./.github/actions/build-unclog | ||
with: | ||
artifact-name: unclog # This is the 'release' artifact name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
### Changed | ||
|
||
- refactored github actions to be composable between local workflow testing and artifact "release" |