Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hatch/artifact/create action #202

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions hatch/artifact/create/actin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: "Create hatch artifacts"
description: "Build release artifacts using `hatch` as the default build frontend"

inputs:
archive-name:
description: "Name for the GitHub archive for uploading built artifacts, leave blank for no upload"
default: ""
archive-retention:
description: "Duration in days to keep the GitHub archive, requires `archive-name`"
default: "3"
working-directory:
description: "Where to run commands from, primarily supports monorepo setups (e.g. <sub-package-dir>/"
default: "./"

runs:
using: composite
steps:
- name: "[DEBUG] Inputs"
shell: bash
run: |
echo "==========INPUTS=========="
echo archive-name : ${{ inputs.archive-name }}
echo archive-retention : ${{ inputs.archive-retention }}
echo working-directory : ${{ inputs.working-directory }}

- name: "Build artifacts"
shell: bash
run: |
hatch build
hatch run build:check-all
working-directory: ${{ inputs.working-directory }}

- name: "[INFO] Built artifacts"
shell: bash
run: echo "::notice title=$TITLE::$MESSAGE"
env:
TITLE: "[${{ env.NOTIFICATION_PREFIX }}]: Built artifacts"
MESSAGE: $(ls ./dist)
working-directory: ${{ inputs.working-directory }}

- name: "Upload artifacts"
if: ${{ !(inputs.archive-name == '') }}
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.archive-name }}
path: ${{ inputs.working-directory }}dist/
retention-days: ${{ fromJSON(inputs.archive-retention) }}

- name: "[INFO] Uploaded artifacts"
if: ${{ !(inputs.archive-name == '') }}
shell: bash
run: echo "::notice title=$TITLE::$MESSAGE"
env:
TITLE: "[${{ env.NOTIFICATION_PREFIX }}]: Uploaded artifacts"
MESSAGE: "Uploaded artifacts to ${{ inputs.archive-name }}"

- name: "[DEBUG] Outputs"
shell: bash
run: |
echo "==========OUTPUTS=========="
echo "N/A"