fix: use repository fullname to fetch contributors (#77) #35
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Semantic release | |
on: | |
push: | |
branches: | |
- main | |
- beta | |
workflow_dispatch: | |
jobs: | |
release: | |
name: Semantic release | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- name: Generate token | |
id: generate_token | |
uses: tibdex/github-app-token@v1 | |
with: | |
app_id: ${{ secrets.OS_GITHUB_APP_ID }} | |
private_key: ${{ secrets.OS_GITHUB_APP_PRIVATE_KEY }} | |
- name: "☁️ checkout repository" | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
token: ${{ steps.generate_token.outputs.token }} | |
- name: "🔧 setup node" | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: "🔧 install npm@latest" | |
run: npm i -g npm@latest | |
- name: "🚀 release" | |
id: semantic-release | |
env: | |
# This ensures that publishing happens on every single trigger which then | |
# forces the go binaries to be built in the next step and attached to the GitHub release | |
FORCE_PUBLISH: "patch" | |
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
NPM_PACKAGE_ROOT: "npm" | |
uses: open-sauced/release@v2.2.1 | |
outputs: | |
release-tag: ${{ steps.semantic-release.outputs.release-tag }} | |
build: | |
needs: | |
- release | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write # release changes require contents write | |
strategy: | |
matrix: | |
goos: [darwin, linux, windows] | |
goarch: [amd64, arm64] | |
steps: | |
- name: Set up Go | |
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 | |
with: | |
go-version: 1.21.x | |
- name: Check out code | |
uses: actions/checkout@v3 | |
- name: Build and upload Go binaries | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
CGO_ENABLED=0 GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build \ | |
-ldflags="-s -w" \ | |
-ldflags="-X 'github.com/open-sauced/pizza-cli/pkg/utils.writeOnlyPublicPosthogKey=${{ vars.POSTHOG_WRITE_PUBLIC_KEY }}'" \ | |
-ldflags="-X 'github.com/open-sauced/pizza-cli/pkg/utils.Version=${{ needs.release.outputs.release-tag }}'" \ | |
-ldflags="-X 'github.com/open-sauced/pizza-cli/pkg/utils.Sha=$(git rev-parse HEAD)'" \ | |
-o build/pizza-${{ matrix.goos }}-${{ matrix.goarch }} | |
gh release upload ${{ needs.release.outputs.release-tag }} build/pizza-${{ matrix.goos }}-${{ matrix.goarch }} | |