Skip to content

ci: add build, lint and release workflows #1

ci: add build, lint and release workflows

ci: add build, lint and release workflows #1

name: Build
on:
pull_request: {}
push:
tags:
- v*
jobs:
prepare-release:
name: Prepare release
runs-on: ubuntu-latest
if: github.event_name == "push"

Check failure on line 13 in .github/workflows/build-release.yaml

View workflow run for this annotation

GitHub Actions / Build

Invalid workflow file

The workflow is not valid. .github/workflows/build-release.yaml (Line: 13, Col: 9): Unexpected symbol: '"push"'. Located at position 22 within expression: github.event_name == "push" .github/workflows/build-release.yaml (Line: 43, Col: 13): Unexpected symbol: '"push"'. Located at position 22 within expression: github.event_name == "push"
steps:
- run: |-
gh release create "${{ github.ref_name }}" \
--target "${{ github.sha }}"
build:
name: Build
runs-on: ubuntu-latest
needs: [ prepare-release ]
strategy:
matrix:
goos: [ linux ]
goarch: [ amd64, arm64 ]
steps:
- uses: actions/checkout@v4
- name: Extract k6 version from go.mod
id: version
run: |-
k6version=$(grep -e go.k6.io go.mod | cut -d' ' -f 2)
echo "Detected k6 version: ${k6version}"
echo "k6=${k6version}" >> $GITHUB_OUTPUT
- name: Build with xk6
run: |-
docker run --rm -i -u "$(id -u):$(id -g)" -v "${PWD}:/xk6" \
-e "GOOS=${{ matrix.goos }}" -e "GOARCH=${{ matrix.goarch }}" \
grafana/xk6 build ${{ steps.version.outputs.k6 }} \
--output "dist/sm-k6-${{ matrix.goos }}-${{ matrix.goarch }}" \
--with sm=.
- name: Upload artifact to release
if: github.event_name == "push"
run: |-
gh release upload "${{ github.ref_name }}" dist/*