Skip to content

Merge pull request #2 from zyyw/sbom-fake-scanner #5

Merge pull request #2 from zyyw/sbom-fake-scanner

Merge pull request #2 from zyyw/sbom-fake-scanner #5

Workflow file for this run

name: Releases
on:
push:
branches:
- main
jobs:
create-release:
runs-on: ubuntu-latest
outputs:
release-id: ${{ steps.create_release.outputs.id }}
release-tag: ${{ steps.short-sha.outputs.sha }}
steps:
- uses: benjlevesque/[email protected]
id: short-sha
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.short-sha.outputs.sha }}
release_name: ${{ steps.short-sha.outputs.sha }}
body: |
Release ${{ steps.short-sha.outputs.sha }}
draft: false
prerelease: true
build-upload-assets:
needs: [create-release]
runs-on: ubuntu-latest
strategy:
matrix:
goos: [linux, windows, darwin]
goarch: [amd64]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Run go generate
run: make go-generate
- name: Release ${{ matrix.goos }}-${{ matrix.goarch }}
uses: wangyoucao577/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
goversion: https://dl.google.com/go/go1.20.7.linux-amd64.tar.gz
pre_command: export CGO_ENABLED=0
build_flags: -a -tags netgo
binary_name: harbor-scanner-fake
release_tag: ${{ needs.create-release.outputs.release-tag }}
- name: Rollback Release
if: failure()
uses: author/action-rollback@stable
with:
release_id: ${{ needs.create-release.outputs.release-id }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish-release:
needs: [create-release, build-upload-assets]
runs-on: ubuntu-latest
steps:
- uses: meeDamian/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ needs.create-release.outputs.release-tag }}
prerelease: false
allow_override: true
delete-older-releases:
needs: [publish-release]
runs-on: ubuntu-latest
steps:
- uses: dev-drprasad/[email protected]
with:
keep_latest: 1
delete_tags: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}