Skip to content

feat: pre-commit

feat: pre-commit #79

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*.*.*'
permissions:
contents: write
jobs:
Dirty:
runs-on: "formance-runner"
steps:
- uses: 'actions/checkout@v4'
with:
fetch-depth: 0
- name: Setup Env
uses: ./.github/actions/env
- run: >
earthly
--allow-privileged
--secret SPEAKEASY_API_KEY=$SPEAKEASY_API_KEY
${{ contains(github.event.pull_request.labels.*.name, 'no-cache') && '--no-cache' || '' }}
+pre-commit
env:
SPEAKEASY_API_KEY: ${{ secrets.SPEAKEASY_API_KEY }}
- name: Get changed files
id: changed-files
run: |
hasChanged=$(git status --porcelain)
if (( $(echo ${#hasChanged}) != 0 )); then
git status
echo "There are changes in the repository"
exit 1
fi
Extract:
name: Extract
runs-on: "ubuntu-latest"
outputs:
components: ${{ steps.extract.outputs.components }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Extract service name
id: extract
run: echo "components=$(node .github/actions/find-directory/index.js)" >> $GITHUB_OUTPUT
GoReleaser:
runs-on: "ubuntu-latest"
needs:
- Extract
- Dirty
strategy:
matrix:
components: ${{ fromJson(needs.Extract.outputs.components) }}
steps:
- uses: earthly/actions-setup@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
version: "latest"
- uses: 'actions/checkout@v4'
with:
fetch-depth: 0
- name: Setup Env
uses: ./.github/actions/env
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: "NumaryBot"
password: ${{ secrets.NUMARY_GITHUB_TOKEN }}
- run: >
earthly
--no-output
--allow-privileged
--secret SPEAKEASY_API_KEY=$SPEAKEASY_API_KEY
--secret GITHUB_TOKEN=$GITHUB_TOKEN
--secret FURY_TOKEN=$FURY_TOKEN
--secret GORELEASER_KEY=$GORELEASER_KEY
${{ contains(github.event.pull_request.labels.*.name, 'no-cache') && '--no-cache' || '' }}
+goreleaser --path=${{ matrix.components }} --mode=release
env:
GITHUB_TOKEN: ${{ secrets.NUMARY_GITHUB_TOKEN }}
SPEAKEASY_API_KEY: ${{ secrets.SPEAKEASY_API_KEY }}
FURY_TOKEN: ${{ secrets.FURY_TOKEN }}
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
OpenAPI:
runs-on: "ubuntu-latest"
needs:
- GoReleaser
steps:
- uses: earthly/actions-setup@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
version: "latest"
- uses: 'actions/checkout@v4'
with:
fetch-depth: 0
- name: Setup Env
uses: ./.github/actions/env
- name: Generate OpenAPI final specification
run: >
earthly +build-final-spec --version=${{github.ref_name}}
- name: Add the OpenAPI file to the release assets
run: >
gh release upload ${{github.ref_name}} ./releases/build/generate.json#openapi.json
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Helm:
runs-on: "ubuntu-latest"
needs:
- GoReleaser
steps:
- uses: earthly/actions-setup@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
version: "latest"
- uses: 'actions/checkout@v4'
with:
fetch-depth: 0
- name: Setup Env
uses: ./.github/actions/env
- name: Publish Helm
run: >
earthly
--allow-privileged
--secret GITHUB_TOKEN=$GITHUB_TOKEN
+helm-publish
env:
GITHUB_TOKEN: ${{ secrets.NUMARY_GITHUB_TOKEN }}