diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a6c129a..4f7e77e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,38 +29,37 @@ jobs: publish release - # check: - # uses: ./.github/workflows/run.yml - # needs: [discover] - # with: - # earthfiles: ${{ toJson(fromJson(needs.discover.outputs.result)['^check.*']) }} - # forge_version: ${{ inputs.forge_version }} + check: + uses: ./.github/workflows/run.yml + needs: [discover] + with: + earthfiles: ${{ toJson(fromJson(needs.discover.outputs.result)['^check.*']) }} + forge_version: ${{ inputs.forge_version }} - # build: - # uses: ./.github/workflows/run.yml - # needs: [discover, check] - # with: - # earthfiles: ${{ toJson(fromJson(needs.discover.outputs.result)['^build.*']) }} - # forge_version: ${{ inputs.forge_version }} + build: + uses: ./.github/workflows/run.yml + needs: [discover, check] + with: + earthfiles: ${{ toJson(fromJson(needs.discover.outputs.result)['^build.*']) }} + forge_version: ${{ inputs.forge_version }} - # test: - # uses: ./.github/workflows/run.yml - # needs: [discover, check, build] - # with: - # earthfiles: ${{ toJson(fromJson(needs.discover.outputs.result)['^test.*']) }} - # forge_version: ${{ inputs.forge_version }} + test: + uses: ./.github/workflows/run.yml + needs: [discover, check, build] + with: + earthfiles: ${{ toJson(fromJson(needs.discover.outputs.result)['^test.*']) }} + forge_version: ${{ inputs.forge_version }} - # publish: - # uses: ./.github/workflows/publish.yml - # needs: [discover, check, build, test] - # with: - # earthfiles: ${{ toJson(fromJson(needs.discover.outputs.result)['publish']) }} - # forge_version: ${{ inputs.forge_version }} + publish: + uses: ./.github/workflows/publish.yml + needs: [discover, check, build, test] + with: + earthfiles: ${{ toJson(fromJson(needs.discover.outputs.result)['publish']) }} + forge_version: ${{ inputs.forge_version }} release: uses: ./.github/workflows/release.yml - #needs: [discover, check, build, test, publish] - needs: [discover] + needs: [discover, check, build, test] with: earthfiles: ${{ toJson(fromJson(needs.discover.outputs.result)['release']) }} forge_version: ${{ inputs.forge_version }} \ No newline at end of file diff --git a/forge/actions/release/README.md b/forge/actions/release/README.md index 2fefee8..a7f385f 100644 --- a/forge/actions/release/README.md +++ b/forge/actions/release/README.md @@ -1,12 +1,12 @@ # Release Action -The publish action pushes Docker images to remote registries using settings from a project's blueprint file. -It automatically handles the configured tagging strategy as well as properly handling git tags. +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 Publish +name: Run Release on: push: @@ -15,52 +15,35 @@ permissions: id-token: write jobs: - publish: + release: runs-on: ubuntu-latest steps: - name: Setup uses: input-output-hk/catalyst-forge/forge/actions/setup@master - - name: Publish - uses: input-output-hk/catalyst-forge/forge/actions/discover@master + - name: Release + if: startsWith(github.ref, 'refs/tags/') + uses: input-output-hk/catalyst-forge/forge/actions/release@master with: project: ./my/project/path - container: container:tag + path: ./path/to/artifacts ``` -The given project _must_ have a blueprint at the root of the path which, at the very least, declares a project name. -By default, the `container` property of a project uses the project name if not specified. -Alternatively, the `container` field can be set explicitly. -The `container` input to the publish action _must_ match an existing container image in the local Docker daemon. -The given container name is discarded and the value of the `container` field is used for naming the container. +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: -The final tags the container is published with are determined by the blueprint configuration and the git context: +- 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 `global.ci.tagging.strategy` configuration property determines the default tag given to all images -- If the git context contains a git tag, then the publish action may or may not publish an image with the tag: - - If the tag is in the "mono-repo" style (`some/path/v1.0.0`) - - If the path (`some/path`) matches an alias in `global.ci.tagging.strategy.aliases`, and the value of the alias matches the - given project, then the tag is used - - If the path does not match an alias, but the path itself matches the given project, then the tag is used - - If none of the above are true, the tag is assumed to be for a different project and is skipped - - If the tag is any other style, it's used as-is (no modifications) +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: -The following table provides an example of how the git tag is used in various contexts: - -| Project | Git tag | Aliases | Image tag | -| ------------- | -------------------- | ------------------------ | --------- | -| `my/cool/cli` | None | None | Not used | -| `my/cool/cli` | `v1.0.0` | None | `v1.0.0` | -| `my/cool/cli` | `my/v1.0.0` | None | Not used | -| `my/cool/cli` | `my/cool/cli/v1.0.0` | None | `v1.0.0` | -| `my/cool/cli` | `cli/v1.0.0` | `{"cli": "my/cool/cli"}` | `v1.0.0` | - -After processing any additional tags, the container is retagged with each generated tag and pushed to all registries configured in -`global.ci.registries`. -The publish action assumes the local Docker daemon is already authenticated to any configured registries. +- If the git tag is a mono-repo tag, the archive is named in the format of: `-.tar.gz` +- If the git tag is not a mono-repo tag, the archive is named in the format of: `-.tar.gz` ## Inputs -| Name | Description | Required | Default | -| ------- | ------------------------------------------------ | -------- | ------- | -| project | The relative path to the project (from git root) | Yes | N/A | -| image | The existing container image to publish | Yes | N/A | +| 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 |