make release to flat folder #65
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
push: | |
branches: | |
- master | |
- main | |
tags: | |
- '[0-9]+.[0-9]+.[0-9]+' | |
paths-ignore: | |
- 'docs/**' | |
- 'deploy/**' | |
- 'examples/**' | |
- 'test/**' | |
- '*.md' | |
- '*.yaml' | |
jobs: | |
build: | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set Up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.21' | |
cache: true | |
cache-dependency-path: go.sum | |
- name: Build Release Binaries | |
env: | |
GOPROXY: https://proxy.golang.org | |
CGO_ENABLED: 0 | |
run: | | |
make release | |
- name: Debug Directory Contents | |
run: | | |
ls -la .bin/ || echo "Directory .bin/ is empty or does not exist" | |
- name: Upload Build Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pumba-binaries | |
path: .bin/** | |
retention-days: 7 | |
compression-level: 6 | |
create-release: | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
name: Create GitHub Release | |
needs: [ build ] | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Get Tag Name | |
id: get_tag | |
run: echo "git_tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
- name: Download Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: pumba-binaries | |
path: ${{ github.workspace }}/.bin/ | |
job-id: build | |
- name: Create GitHub Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.get_tag.outputs.git_tag }} | |
release_name: ${{ steps.get_tag.outputs.git_tag }} | |
prerelease: true | |
generate_release_notes: true | |
- name: Upload Release Assets | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ${{ github.workspace }}/.bin/** | |
asset_name: pumba-binaries-${{ steps.get_tag.outputs.git_tag }}.tar.gz | |
asset_content_type: application/gzip | |
push-docker: | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
name: Push Docker Image | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Get Tag Name | |
id: get_tag | |
run: echo "git_tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
- name: Get Short SHA | |
id: short_sha | |
run: echo "sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
- name: Set Up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
driver: docker-container | |
platforms: linux/amd64,linux/arm64 | |
- name: Set Up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: linux/amd64,linux/arm64 | |
- name: Login to Docker Registry | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_ACCOUNT }} | |
password: ${{ secrets.DOCKER_TOKEN }} | |
- name: Build Metadata | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ secrets.DOCKER_ORG }}/pumba | |
tags: | | |
type=semver,pattern={{version}} | |
type=raw,value=latest | |
- name: Build and Push Docker Image | |
uses: docker/build-push-action@v6 | |
with: | |
file: docker/Dockerfile | |
context: . | |
build-args: | | |
BRANCH=${{ github.ref_name }} | |
COMMIT=${{ steps.short_sha.outputs.sha }} | |
SKIP_TESTS=true | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
provenance: true | |
sbom: true |