From 441757227adb086a8e94c0fe9e0e5d93ad7d2dee Mon Sep 17 00:00:00 2001 From: Felipe Rios Date: Thu, 8 Feb 2024 22:56:26 -0500 Subject: [PATCH] feat(binary): added the binary release feature for GoLang pipelines Signed-off-by: Felipe Rios --- .github/workflows/go-binary.yaml | 9 +++++- .../stages/40-delivery/binary/action.yaml | 32 ++++++++++++++++++- .../stages/40-delivery/release/action.yaml | 2 +- 3 files changed, 40 insertions(+), 3 deletions(-) diff --git a/.github/workflows/go-binary.yaml b/.github/workflows/go-binary.yaml index b480fa2a..69b9b717 100644 --- a/.github/workflows/go-binary.yaml +++ b/.github/workflows/go-binary.yaml @@ -1,6 +1,11 @@ on: workflow_call: +inputs: + binary_name: + description: 'Binary name to be used as default source' + required: true + jobs: go: uses: 'rios0rios0/pipelines/.github/workflows/go.yaml@main' @@ -18,6 +23,8 @@ jobs: name: 'delivery > binary' runs-on: 'ubuntu-latest' steps: - - uses: 'rios0rios0/pipelines/github/global/stages/40-delivery/deb-releaser@main' + - uses: 'rios0rios0/pipelines/github/global/stages/40-delivery/binary@main' + with: + binary_name: '${{ inputs.binary_name }}' needs: [ 'delivery-release' ] if: "(github.event_name == 'push' && github.ref == 'refs/heads/main') || startsWith(github.ref, 'refs/tags/')" diff --git a/github/global/stages/40-delivery/binary/action.yaml b/github/global/stages/40-delivery/binary/action.yaml index fb8bb334..ca5c15d7 100644 --- a/github/global/stages/40-delivery/binary/action.yaml +++ b/github/global/stages/40-delivery/binary/action.yaml @@ -1,7 +1,37 @@ on: workflow_call: +inputs: + binary_name: + description: 'Binary name to be used as default source' + required: true + runs: using: 'composite' + env: + PACKAGE_NAME: '${{ inputs.binary_name }}-${{ github.ref[10:] }}' + DEBIAN_FRONTEND: 'noninteractive' steps: - # TODO: it should be finished with: "https://github.com/rios0rios0/autobump/blob/main/.github/workflows/release.yml#L68" + - run: | + make build + strip -s bin/${{ inputs.binary_name }} + shell: 'bash' + - run: | + cd bin + zip -9 ${{ env.PACKAGE_NAME }}.zip ${{ inputs.binary_name }} + shell: 'bash' + - uses: 'actions/upload-artifact@v2' + with: + name: '${{ inputs.binary_name }}' + path: 'bin/${{ env.PACKAGE_NAME }}.zip' + - uses: 'actions/download-artifact@v2' + with: + name: '${{ inputs.binary_name }}' + - uses: 'actions/upload-release-asset@v1' + #env: + # GITHUB_TOKEN: '${{ github.token }}' + with: + upload_url: '${{ steps.create_release.outputs.upload_url }}' + asset_path: '${{ env.PACKAGE_NAME }}.zip' + asset_name: '${{ env.PACKAGE_NAME }}.zip' + asset_content_type: 'application/zip' diff --git a/github/global/stages/40-delivery/release/action.yaml b/github/global/stages/40-delivery/release/action.yaml index 73e10a25..b2a78198 100644 --- a/github/global/stages/40-delivery/release/action.yaml +++ b/github/global/stages/40-delivery/release/action.yaml @@ -4,7 +4,7 @@ on: runs: using: 'composite' outputs: - upload_url: ${{ steps.create_release.outputs.upload_url }} + upload_url: '${{ steps.create_release.outputs.upload_url }}' steps: - id: 'create_release' uses: 'softprops/action-gh-release@v1'