Skip to content

Commit

Permalink
use composite action for output plumbing
Browse files Browse the repository at this point in the history
  • Loading branch information
kasey committed Jan 8, 2025
1 parent 66fe56b commit 4f5e55c
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 61 deletions.
54 changes: 54 additions & 0 deletions .github/actions/build-unclog/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
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:
- uses: actions/checkout@v4

- 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
57 changes: 0 additions & 57 deletions .github/workflows/build-unclog.yml

This file was deleted.

11 changes: 7 additions & 4 deletions .github/workflows/dogfood.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,28 @@ jobs:
artifact-name: ${{ steps.unclog-build.outputs.artifact-name }}
steps:

- name: Checkout source code
uses: actions/checkout@v4

- name: Run unclog build
id: unclog-build
uses: ./.github/workflows/build-unclog.yml
uses: ./.github/actions/build-unclog

run-changelog-check:
runs-on: ubuntu-latest
needs: build-unclog

steps:

- name: Checkout source code
uses: actions/checkout@v4

- name: Download changelog check binary
id: unclog-download
uses: actions/download-artifact@v4
with:
name: ${{ needs.build-unclog.outputs.artifact-name }}

- name: Checkout source code
uses: actions/checkout@v4

- name: Get new changelog files
id: new-changelog-files
uses: tj-actions/changed-files@v45
Expand Down

0 comments on commit 4f5e55c

Please sign in to comment.