-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
42,516 additions
and
21 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
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,62 @@ | ||
on: | ||
workflow_call: | ||
inputs: | ||
earthfiles: | ||
description: | | ||
A JSON list of Earthfile paths+targets to use for publishing | ||
required: true | ||
type: string | ||
forge_version: | ||
description: | | ||
The version of the forge CLI to install (use 'local' for testing) | ||
required: true | ||
type: string | ||
|
||
env: | ||
OUTPUT: ${{ github.workspace }}/output | ||
|
||
jobs: | ||
run: | ||
name: ${{ matrix.earthfile }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
earthfile: ${{ fromJson(inputs.earthfiles) }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup CI | ||
uses: ./forge/actions/setup | ||
with: | ||
forge_version: ${{ inputs.forge_version }} | ||
- name: Run | ||
id: run | ||
uses: ./forge/actions/run | ||
with: | ||
artifact: ${{ env.OUTPUT }} | ||
path: ${{ matrix.earthfile }} | ||
- name: Get project and artifacts | ||
id: artifact | ||
if: startsWith(github.ref, 'refs/tags/') | ||
run: | | ||
EARTHFILE='${{ matrix.earthfile }}' | ||
PROJECT="${EARTHFILE%+*}" | ||
TARGET="${EARTHFILE#*+}" | ||
RESULT='${{ steps.run.outputs.result }}' | ||
ARTIFACT_COUNT="$(echo "$RESULT" | jq -r '.artifacts | length')" | ||
if [[ $ARTIFACT_COUNT -eq 0 ]]; then | ||
echo "::error file=${PROJECT}/Earthfile::No artifacts produced. Nothing to release." | ||
exit 1 | ||
fi | ||
ls -l ${{ env.OUTPUT }} | ||
echo "project=$PROJECT" >> $GITHUB_OUTPUT | ||
- name: Release | ||
uses: ./forge/actions/release | ||
if: startsWith(github.ref, 'refs/tags/') | ||
with: | ||
path: ${{ env.OUTPUT }} | ||
project: ${{ steps.artifact.outputs.project }} |
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,49 @@ | ||
# Release Action | ||
|
||
The release action creates a new GitHub release and uploads artifacts to it. | ||
It automatically handles parsing git tags in order to generate the release name. | ||
|
||
## Usage | ||
|
||
```yaml | ||
name: Run Release | ||
on: | ||
push: | ||
|
||
permissions: | ||
contents: read | ||
id-token: write | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Setup | ||
uses: input-output-hk/catalyst-forge/forge/actions/setup@master | ||
- name: Release | ||
if: startsWith(github.ref, 'refs/tags/') | ||
uses: input-output-hk/catalyst-forge/forge/actions/release@master | ||
with: | ||
project: ./my/project/path | ||
path: ./path/to/artifacts | ||
``` | ||
The action should only be run when a git tag is present. | ||
The given project is used to determine whether a release should happen or not: | ||
- If the git tag is a mono-repo tag and it matches the given project, then a release is made | ||
- If the git tag is not a mono-repo tag, a release always occurs | ||
The release is named the same as the git tag. | ||
The given `path` is archived in a `.tar.gz` file and uploaded as an asset for the release. | ||
The name of the archive depends on the git tag: | ||
|
||
- If the git tag is a mono-repo tag, the archive is named in the format of: `<prefix>-<platform>.tar.gz` | ||
- If the git tag is not a mono-repo tag, the archive is named in the format of: `<repo_name>-<platform>.tar.gz` | ||
|
||
## Inputs | ||
|
||
| Name | Description | Required | Default | | ||
| ------- | -------------------------------------------------- | -------- | ------- | | ||
| project | The relative path to the project (from git root) | Yes | N/A | | ||
| path | The path to any artifacts to attach to the release | Yes | N/A | |
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: Release | ||
description: Create a new GitHub release and upload generated artifacts | ||
inputs: | ||
github_token: | ||
description: The token to use for creating a new release | ||
required: false | ||
default: ${{ github.token }} | ||
project: | ||
description: The path to the project | ||
required: true | ||
path: | ||
description: The path to generated artifacts | ||
required: true | ||
platform: | ||
description: The platform the artifacts are targeting | ||
required: false | ||
default: "linux-amd64" | ||
|
||
runs: | ||
using: node20 | ||
main: dist/index.js |
Oops, something went wrong.