From 82dfc5aefa0b7682a06d6859735cb48cb4a50f9a Mon Sep 17 00:00:00 2001 From: Akash Satheesan Date: Wed, 17 Mar 2021 22:46:16 +0530 Subject: [PATCH 1/2] feat: Use GitHub actions to upload release artifacts --- .github/workflows/release.yaml | 70 ++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..63092d5 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,70 @@ +on: + release: + types: + - created + +name: Build Release +jobs: + release-linux-amd64: + name: x86_64 Linux release + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-go@v2 + with: + go-version: '^1.15' # The Go version to download (if necessary) and use. - name: compile and release + - run: go build -v -o cloud-agent-linux-amd64 + env: + GOARCH: amd64 + GOOS: linux + - run: hub release edit -m "" -a ./cloud-agent-linux-amd64 $(echo $GITHUB_REF | cut -d/ -f3) + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + release-linux-arm64: + name: ARM64 Linux release + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-go@v2 + with: + go-version: '^1.15' # The Go version to download (if necessary) and use. - name: compile and release + - run: go build -v -o cloud-agent-linux-arm64 + env: + GOARCH: arm64 + GOOS: linux + - run: hub release edit -m "" -a ./cloud-agent-linux-arm64 $(echo $GITHUB_REF | cut -d/ -f3) + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + release-macos-amd64: + name: x86_64 macOS release + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-go@v2 + with: + go-version: '^1.15' # The Go version to download (if necessary) and use. - name: compile and release + - run: go build -v -o cloud-agent-macos-amd64 + env: + GOARCH: amd64 + GOOS: darwin + - run: hub release edit -m "" -a ./cloud-agent-macos-amd64 $(echo $GITHUB_REF | cut -d/ -f3) + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + release-macos-arm64: + name: ARM64 macOS release + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-go@v2 + with: + go-version: '^1.15' # The Go version to download (if necessary) and use. - name: compile and release + - run: go build -v -o cloud-agent-macos-arm64 + env: + GOARCH: arm64 + GOOS: darwin + - run: hub release edit -m "" -a ./cloud-agent-macos-arm64 $(echo $GITHUB_REF | cut -d/ -f3) + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 1a2e7d5fd01c21feb5ec1b6f1c15677e9d57f3a2 Mon Sep 17 00:00:00 2001 From: Akash Satheesan Date: Thu, 29 Apr 2021 22:17:54 +0530 Subject: [PATCH 2/2] chore(ci): rewrite to use matrix --- .github/workflows/release.yaml | 68 ++++++++-------------------------- 1 file changed, 15 insertions(+), 53 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 63092d5..d61e023 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -5,66 +5,28 @@ on: name: Build Release jobs: - release-linux-amd64: - name: x86_64 Linux release + release: + name: Build release packages runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-go@v2 - with: - go-version: '^1.15' # The Go version to download (if necessary) and use. - name: compile and release - - run: go build -v -o cloud-agent-linux-amd64 - env: - GOARCH: amd64 - GOOS: linux - - run: hub release edit -m "" -a ./cloud-agent-linux-amd64 $(echo $GITHUB_REF | cut -d/ -f3) - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - release-linux-arm64: - name: ARM64 Linux release - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-go@v2 - with: - go-version: '^1.15' # The Go version to download (if necessary) and use. - name: compile and release - - run: go build -v -o cloud-agent-linux-arm64 - env: - GOARCH: arm64 - GOOS: linux - - run: hub release edit -m "" -a ./cloud-agent-linux-arm64 $(echo $GITHUB_REF | cut -d/ -f3) - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + strategy: + matrix: + goos: [linux, darwin] + goarch: [amd64, arm64] - release-macos-amd64: - name: x86_64 macOS release - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-go@v2 - with: - go-version: '^1.15' # The Go version to download (if necessary) and use. - name: compile and release - - run: go build -v -o cloud-agent-macos-amd64 - env: - GOARCH: amd64 - GOOS: darwin - - run: hub release edit -m "" -a ./cloud-agent-macos-amd64 $(echo $GITHUB_REF | cut -d/ -f3) - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + env: + GOOS: ${{ matrix.goos }} + GOARCH: ${{ matrix.goarch }} - release-macos-arm64: - name: ARM64 macOS release - runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + - uses: actions/setup-go@v2 with: - go-version: '^1.15' # The Go version to download (if necessary) and use. - name: compile and release - - run: go build -v -o cloud-agent-macos-arm64 - env: - GOARCH: arm64 - GOOS: darwin - - run: hub release edit -m "" -a ./cloud-agent-macos-arm64 $(echo $GITHUB_REF | cut -d/ -f3) + go-version: '^1.15' + + - run: go build -v -o cloud-agent-$GOOS-$GOARCH + + - run: gh release upload $(echo $GITHUB_REF | cut -d/ -f3) ./cloud-agent-$GOOS-$GOARCH env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}