Skip to content

Merge branch 'main' of github.com:bruin-data/bruin #169

Merge branch 'main' of github.com:bruin-data/bruin

Merge branch 'main' of github.com:bruin-data/bruin #169

Workflow file for this run

name: Release
on:
push:
tags:
- '*'
permissions:
contents: write
jobs:
prepare-darwin:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Workaround Git Security Warning
run: |
# Workaround a bug in github actions:
git config --global --add safe.directory "$GITHUB_WORKSPACE"
- uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
- shell: bash
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: cache darwin
uses: actions/cache@v3
with:
path: dist/darwin
key: darwin-${{ env.sha_short }}
- name: Run GoReleaser
if: steps.cache.outputs.cache-hit != 'true'
run: |
docker run --privileged -v /var/run/docker.sock:/var/run/docker.sock -e GGOOS=darwin -e GORELEASER_KEY=${{ secrets.GORELEASER_KEY }} -e COMMIT_SHA=${{ github.sha }} -e VERSION=${{ github.ref_name }} -e GITHUB_TOKEN=${{ secrets.RELEASE_TOKEN }} -v $(pwd):/src -w /src ghcr.io/bruin-data/goreleaser-cross-pro:v1.22 release --clean --split --verbose
prepare-linux:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Workaround Git Security Warning
run: |
# Workaround a bug in github actions:
git config --global --add safe.directory "$GITHUB_WORKSPACE"
- uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
- shell: bash
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: cache linux
uses: actions/cache@v3
with:
path: dist/linux
key: linux-${{ env.sha_short }}
- name: Run GoReleaser
if: steps.cache.outputs.cache-hit != 'true'
run: |
docker run --privileged -v /var/run/docker.sock:/var/run/docker.sock -e GGOOS=linux -e GORELEASER_KEY=${{ secrets.GORELEASER_KEY }} -e COMMIT_SHA=${{ github.sha }} -e VERSION=${{ github.ref_name }} -e GITHUB_TOKEN=${{ secrets.RELEASE_TOKEN }} -v $(pwd):/src -w /src ghcr.io/bruin-data/goreleaser-cross-pro:v1.22 release --clean --split --verbose
release-unix:
runs-on: ubuntu-latest
needs: [prepare-linux, prepare-darwin]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Workaround Git Security Warning
run: |
# Workaround a bug in github actions:
git config --global --add safe.directory "$GITHUB_WORKSPACE"
- shell: bash
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- uses: actions/cache@v3
with:
path: dist/linux
key: linux-${{ env.sha_short }}
- uses: actions/cache@v3
with:
path: dist/darwin
key: darwin-${{ env.sha_short }}
- uses: goreleaser/goreleaser-action@v3
with:
distribution: goreleaser-pro
version: v2.3.2
args: continue --merge
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
release-windows:
runs-on: windows-latest
needs: [prepare-linux, prepare-darwin]
defaults:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v3
- uses: msys2/setup-msys2@v2
with:
msystem: UCRT64
update: true
install: git mingw-w64-ucrt-x86_64-gcc
- uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
- name: Release
uses: goreleaser/goreleaser-action@v6
with:
version: v2.3.2
distribution: goreleaser-pro
args: release --clean --split
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
VERSION: ${{ github.ref_name }}
COMMIT_SHA: ${{ github.sha }}
GGOOS: windows
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: dist/windows/bruin_Windows_x86_64.zip
asset_name: bruin_Windows_x86_64.zip
tag: ${{ github.ref }}
overwrite: false
make_latest: false
prerelease: false
install-windows:
runs-on: windows-latest
name: Installer Script on Windows
needs: [release-windows, release-unix]
steps:
- uses: actions/checkout@v3
- name: Use install script
shell: bash
run: curl -LsSf https://raw.githubusercontent.com/bruin-data/bruin/refs/heads/main/install.sh | sh -s -- -d ${GITHUB_REF##*/}
- name: Test Pipeline
shell: bash
run: /c/Users/runneradmin/.local/bin/bruin.exe init duckdb test-pipeline && cd test-pipeline && git init && /c/Users/runneradmin/.local/bin/bruin.exe run .
install-unix:
runs-on: ubuntu-latest
name: Installer Script on Linux
needs: [release-windows, release-unix]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Extract tag from ref
id: extract_tag
run: |
ref_name="${GITHUB_REF##*/}"
echo "tag=${ref_name}" >> $GITHUB_ENV
- name: Use install script
run: curl -LsSf https://raw.githubusercontent.com/bruin-data/bruin/refs/heads/main/install.sh | sh -s -- -d ${{ env.tag }}
- name: Test Pipeline
run: bruin init duckdb test-pipeline && cd test-pipeline && git init && bruin run .
release:
runs-on: ubuntu-latest
needs: [install-unix, install-windows]
steps:
- uses: actions/checkout@v3
- name: Extract tag from ref
id: extract_tag
run: |
ref_name="${GITHUB_REF##*/}"
echo "tag=${ref_name}" >> $GITHUB_ENV
- name: Release promote to latest
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: ${{ env.tag }}
prerelease: false
make_latest: true
clear_attachments: false