diff --git a/.github/actions/build-unclog/action.yml b/.github/actions/build-unclog/action.yml new file mode 100644 index 0000000..4770a3c --- /dev/null +++ b/.github/actions/build-unclog/action.yml @@ -0,0 +1,53 @@ +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 + 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 diff --git a/.github/workflows/build-unclog.yml b/.github/workflows/build-unclog.yml deleted file mode 100644 index ebbadfb..0000000 --- a/.github/workflows/build-unclog.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: build-unclog - -on: - workflow_call: - inputs: - artifact-name: - required: false - type: string - outputs: - artifact-name: - description: "name of uploaded artifact" - value: ${{ jobs.build_unclog.outputs.artifact-name}} - -jobs: - build-unclog: - runs-on: ubuntu-latest - outputs: - artifact-name: ${{ steps.artifact-namer.outputs.artifact-name }} - steps: - - uses: actions/checkout@v4 - - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version: '1.22' - - - name: Build - 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 diff --git a/.github/workflows/dogfood.yml b/.github/workflows/dogfood.yml index 194cf63..72a51d8 100644 --- a/.github/workflows/dogfood.yml +++ b/.github/workflows/dogfood.yml @@ -14,9 +14,12 @@ 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 @@ -24,15 +27,15 @@ jobs: 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