Skip to content

refactor!: add maru=true variable and refactoring (#97) #6

refactor!: add maru=true variable and refactoring (#97)

refactor!: add maru=true variable and refactoring (#97) #6

Workflow file for this run

name: Release Maru on Tag
on:
push:
tags:
- "v*"
jobs:
build:
runs-on: ubuntu-latest
steps:
# Checkout the repo and setup the tooling for this job
- name: Checkout
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
fetch-depth: 0
- name: Setup golang
uses: ./.github/actions/golang
- name: Build CLI
run: |
make build-cli-linux-amd
# Upload the contents of the build directory for later stages to use
- name: Upload build artifacts
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with:
name: build-artifacts
path: build/
retention-days: 1
validate:
runs-on: ubuntu-latest
permissions:
packages: write
needs: build
steps:
# Checkout the repo and setup the tooling for this job
- name: Checkout
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
fetch-depth: 0
- name: Download build artifacts
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
with:
name: build-artifacts
path: build/
- name: Install Zarf
uses: ./.github/actions/zarf
- name: Setup golang
uses: ./.github/actions/golang
- name: Make maru executable
run: |
chmod +x build/maru
- name: Run unit tests
run: |
make test-unit
- name: Run e2e tests
run: |
make test-e2e
- name: Save logs
if: always()
uses: ./.github/actions/save-logs
push:
runs-on: ubuntu-latest
environment: release
needs: validate
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
fetch-depth: 0
- name: Setup golang
uses: ./.github/actions/golang
- name: Install tools
uses: ./.github/actions/install-tools
- name: Download build artifacts
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
with:
name: build-artifacts
path: build/
- name: Skip brew latest for pre-release tags
run: |
if [[ $GITHUB_REF_NAME == *"rc"* ]]; then
echo "BREW_NAME=maru@latest-rc" >> $GITHUB_ENV
else
echo "BREW_NAME=maru" >> $GITHUB_ENV
fi
- name: Get Brew tap repo token
id: brew-tap-token
uses: actions/create-github-app-token@a0de6af83968303c8c955486bf9739a57d23c7f1 # v1.10.0
with:
app-id: ${{ secrets.HOMEBREW_TAP_WORKFLOW_GITHUB_APP_ID }}
private-key: ${{ secrets.HOMEBREW_TAP_WORKFLOW_GITHUB_APP_SECRET }}
owner: defenseunicorns
repositories: homebrew-tap
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@5742e2a039330cbb23ebf35f046f814d4c6ff811 # v5.1.0
with:
distribution: goreleaser
version: latest
args: release --rm-dist --debug
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}}
HOMEBREW_TAP_GITHUB_TOKEN: ${{ steps.brew-tap-token.outputs.token }}