Skip to content

cd

cd #238

Workflow file for this run

name: cd
on:
push:
tags:
- '*'
jobs:
release:
if: ${{ github.event.repository.private == true }}
name: Release
strategy:
matrix:
# Quotes are required: https://github.com/actions/setup-go/issues/326#issuecomment-1415719692
go-version: ['1.25']
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
check-latest: true
cache: true
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v7
with:
version: v2.4
- name: Extract and validate version
id: version
run: |
# Get the version from VERSION file
VERSION_FILE=$(cat VERSION)
echo "VERSION_FILE=$VERSION_FILE" >> $GITHUB_OUTPUT
# Ensure tag is v-prefixed, then strip v in one operation
if [[ ! "${{ github.ref_name }}" =~ ^v ]]; then
echo "ERROR: Git tag must be prefixed with 'v' (e.g., v3.5.0)"
echo "Got: ${{ github.ref_name }}"
exit 1
fi
VERSION="${{ github.ref_name }}"
VERSION="${VERSION#v}"
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
- name: Fail if version mismatch
if: ${{ steps.version.outputs.VERSION_FILE != steps.version.outputs.VERSION }}
run: |
echo "VERSION file: '${{steps.version.outputs.VERSION_FILE}}'"
echo "Git ref: '${{ github.ref_name }}'"
echo "Normalized version: '${{ steps.version.outputs.VERSION }}'"
echo "ERROR: Versions do not match!"
exit 1
- name: Install ngrok
run: |
mkdir -p $GITHUB_WORKSPACE/bin
wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip && unzip ngrok-stable-linux-amd64.zip -d $GITHUB_WORKSPACE/bin/
$GITHUB_WORKSPACE/bin/ngrok authtoken ${{ secrets.NGROK_TOKEN }}
- name: Setup integration resources
run: export NGROK_DIR=$GITHUB_WORKSPACE/bin/ && make integration-up
- name: Run integration & unit tests
run: make integration-test
- name: Compile all targets
run: make all
- name: Setup e2e resources
run: make e2e-up
- name: Run e2e tests
run: make e2e-test
- name: Snyk Setup
uses: snyk/actions/setup@master
- name: Run Snyk to check for vulnerabilities in main Docker image
run: snyk container test snowplow/snowbridge:${{ steps.version.outputs.VERSION }} --severity-threshold=high
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
- name: Run Snyk to check for vulnerabilities in aws-only Docker image
run: snyk container test snowplow/snowbridge:${{ steps.version.outputs.VERSION }}-aws-only --severity-threshold=high
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
- name: Run Snyk to monitor for vulnerabilities in main Docker image
uses: snyk/actions/docker@master
if: ${{ !contains(github.ref, '-') }}
with:
image: "snowplow/snowbridge:${{ steps.version.outputs.VERSION }}"
args: "--app-vulns --org=data-processing-new --project-name=snowbridge-main"
command: monitor
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
- name: Run Snyk to monitor for vulnerabilities in aws-only Docker image
uses: snyk/actions/docker@master
if: ${{ !contains(github.ref, '-') }}
with:
image: "snowplow/snowbridge:${{ steps.version.outputs.VERSION }}-aws-only"
args: "--app-vulns --org=data-processing-new --project-name=snowbridge-aws-only"
command: monitor
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
- name: Create GitHub release and attach artifacts
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
draft: true
prerelease: ${{ contains(github.ref , '-') }}
name: Release ${{ steps.version.outputs.VERSION }}
tag_name: ${{ steps.version.outputs.VERSION }}
files: |
build/compiled/snowbridge_${{ steps.version.outputs.VERSION }}-aws-only_darwin_amd64.zip
build/compiled/snowbridge_${{ steps.version.outputs.VERSION }}-aws-only_darwin_arm64.zip
build/compiled/snowbridge_${{ steps.version.outputs.VERSION }}-aws-only_linux_amd64.zip
build/compiled/snowbridge_${{ steps.version.outputs.VERSION }}-aws-only_linux_arm64.zip
build/compiled/snowbridge_${{ steps.version.outputs.VERSION }}-aws-only_windows_amd64.zip
build/compiled/snowbridge_${{ steps.version.outputs.VERSION }}_darwin_amd64.zip
build/compiled/snowbridge_${{ steps.version.outputs.VERSION }}_darwin_arm64.zip
build/compiled/snowbridge_${{ steps.version.outputs.VERSION }}_linux_amd64.zip
build/compiled/snowbridge_${{ steps.version.outputs.VERSION }}_linux_arm64.zip
build/compiled/snowbridge_${{ steps.version.outputs.VERSION }}_windows_amd64.zip
- name: Publish to DockerHub
run: make container-release
shell: bash