Skip to content

Commit

Permalink
feat(binary): added the binary release feature for GoLang pipelines
Browse files Browse the repository at this point in the history
Signed-off-by: Felipe Rios <[email protected]>
  • Loading branch information
rios0rios0 committed Feb 9, 2024
1 parent ffabc22 commit 4417572
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 3 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/go-binary.yaml
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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/')"
32 changes: 31 additions & 1 deletion github/global/stages/40-delivery/binary/action.yaml
Original file line number Diff line number Diff line change
@@ -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'
2 changes: 1 addition & 1 deletion github/global/stages/40-delivery/release/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit 4417572

Please sign in to comment.