Skip to content

Commit

Permalink
Merge pull request #521 from DefangLabs/lio-go-split-merge
Browse files Browse the repository at this point in the history
test split/merge
  • Loading branch information
lionello authored Jul 2, 2024
2 parents 8acd0cc + 0caf8c1 commit 43c8ec6
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 129 deletions.
62 changes: 35 additions & 27 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ jobs:
# run: GOOS=darwin go build ./cmd/cli
# working-directory: src

# - name: Build Windows binary
# run: GOOS=windows go build ./cmd/cli
# working-directory: src
- name: Build Windows binary
run: GOOS=windows go build ./cmd/cli
working-directory: src

- name: Verify Go modules
working-directory: src
Expand Down Expand Up @@ -118,10 +118,10 @@ jobs:
working-directory: src

build-and-sign:
name: Build app and sign files with Trusted Signing
environment: release
name: Build app and sign files (with Trusted Signing)
environment: release # must use environment to be able to authenticate with Azure Federated Identity for Trusted Signing
needs: go-test
runs-on: windows-latest # for signtool
runs-on: windows-latest
env: # from https://github.com/spiffe/spire/pull/5158
GOPATH: 'D:\golang\go'
GOCACHE: 'D:\golang\cache'
Expand All @@ -139,13 +139,27 @@ jobs:
run: go mod download
working-directory: src

- name: Run GoReleaser (Windows and Linux)
- name: Run GoReleaser (Linux)
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser-pro # either 'goreleaser' (default) or 'goreleaser-pro'
# version: latest
args: release --split ${{ !startsWith(github.ref, 'refs/tags/v') && '--snapshot' || '' }}
workdir: src
env:
GGOOS: linux
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}

- name: Run GoReleaser (Windows)
uses: goreleaser/goreleaser-action@v5
with:
# distribution: goreleaser-pro # either 'goreleaser' (default) or 'goreleaser-pro'
distribution: goreleaser-pro # either 'goreleaser' (default) or 'goreleaser-pro'
# version: latest
args: release --split ${{ !startsWith(github.ref, 'refs/tags/v') && '--snapshot' || '' }}
workdir: src
env:
GGOOS: windows
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}

# From https://github.com/Azure/trusted-signing-action/pull/37
- name: Azure login
Expand Down Expand Up @@ -187,7 +201,7 @@ jobs:
if-no-files-found: error

build-and-sign-mac:
name: Build app and sign MacOS
name: Build app and sign (MacOS)
needs: go-test
runs-on: macos-latest # for codesign and notarytool
steps:
Expand All @@ -206,11 +220,13 @@ jobs:
- name: Run GoReleaser (macOS)
uses: goreleaser/goreleaser-action@v5
with:
# distribution: goreleaser-pro # either 'goreleaser' (default) or 'goreleaser-pro'
distribution: goreleaser-pro # either 'goreleaser' (default) or 'goreleaser-pro'
# version: latest
args: build --id defang-mac ${{ !startsWith(github.ref, 'refs/tags/v') && '--snapshot' || '' }}
args: release --split ${{ !startsWith(github.ref, 'refs/tags/v') && '--snapshot' || '' }}
workdir: src
env:
GGOOS: darwin
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
MACOS_CERTIFICATE_NAME: ${{ secrets.MACOS_CERTIFICATE_NAME }}
MACOS_P12_BASE64: ${{ secrets.MACOS_P12_BASE64 }}
MACOS_P12_PASSWORD: ${{ secrets.MACOS_P12_PASSWORD }}
Expand Down Expand Up @@ -244,16 +260,16 @@ jobs:
uses: actions/download-artifact@v4
with:
name: dist-mac
path: src/distx
path: src/dist

- name: Download dist-win folder
uses: actions/download-artifact@v4
with:
name: dist-win
path: src/distx
path: src/dist

- name: List files
run: ls -lR src/distx
run: ls -lR src/dist

- name: Set up Go # not sure why this is needed for release
uses: actions/setup-go@v5
Expand All @@ -266,7 +282,7 @@ jobs:
with:
distribution: goreleaser-pro # either 'goreleaser' (default) or 'goreleaser-pro'
# version: latest
args: release --config .goreleaser-prebuilt.yml
args: continue --merge
workdir: src
env:
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
Expand All @@ -288,16 +304,6 @@ jobs:
post-release:
runs-on: ubuntu-latest
needs: go-release

env:
NODE_VERSION: "21"
NPM_REGISTRY_URL: "https://registry.npmjs.org"

defaults:
run:
shell: bash
working-directory: ./pkgs/npm

steps:
- name: Update Windows s.defang.io/defang_win_amd64.zip short link
run: |
Expand Down Expand Up @@ -334,10 +340,12 @@ jobs:
- name: Install node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: ${{ env.NPM_REGISTRY_URL }}
node-version: "20" # same as the version in flake.nix
registry-url: https://registry.npmjs.org

- name: Publish to NPM
shell: bash
working-directory: ./pkgs/npm
run: |
# Get version number without the 'v'
export version_number=`echo "${{ github.ref_name }}" | cut -c2- `
Expand Down
102 changes: 0 additions & 102 deletions src/.goreleaser-prebuilt.yml

This file was deleted.

1 change: 1 addition & 0 deletions src/.goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ nix:
--fish <($out/bin/defang completion fish)
changelog:
use: github
filters:
exclude:
# Ignore messages like "defang: v0.5.3 -> v0.5.4" (which are actually for the previous version)
Expand Down

0 comments on commit 43c8ec6

Please sign in to comment.