Skip to content

Remove goreleaser in favor of build scripts #2143

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 39 commits into from
Jun 18, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
bc06a6f
chore: write build_go.sh script and dependencies
deansheather Jun 7, 2022
850bc82
chore: write build_go_matrix.sh and archive.sh
deansheather Jun 8, 2022
e847230
fixup! chore: write build_go_matrix.sh and archive.sh
deansheather Jun 8, 2022
4edb649
fixup! chore: write build_go_matrix.sh and archive.sh
deansheather Jun 8, 2022
4ed419c
merge main
deansheather Jun 8, 2022
cef0221
chore: add scripts for packages
deansheather Jun 8, 2022
64f9648
chore: add scripts for building a docker image
deansheather Jun 8, 2022
998bc31
chore: add docker multi-arch script and release script
deansheather Jun 9, 2022
46b5d79
fixup! chore: add docker multi-arch script and release script
deansheather Jun 9, 2022
9e279a9
chore: fix indenting
deansheather Jun 9, 2022
4885076
chore: update makefile to use new build scripts
deansheather Jun 9, 2022
044780d
chore: update release workflow to use new build scripts
deansheather Jun 10, 2022
59cd2c7
fixup! chore: update release workflow to use new build scripts
deansheather Jun 12, 2022
d1edee5
fixup! chore: update release workflow to use new build scripts
deansheather Jun 12, 2022
4f03e37
fixup! chore: update release workflow to use new build scripts
deansheather Jun 12, 2022
5c9dd9e
fixup! chore: update release workflow to use new build scripts
deansheather Jun 12, 2022
e09edfd
fixup! chore: update release workflow to use new build scripts
deansheather Jun 13, 2022
4dd6f4d
chore: add dependency checks to release scripts
deansheather Jun 13, 2022
72d8b50
fixup! chore: add dependency checks to release scripts
deansheather Jun 13, 2022
17cda1f
fixup! chore: add dependency checks to release scripts
deansheather Jun 13, 2022
6a4bc44
fixup! chore: add dependency checks to release scripts
deansheather Jun 13, 2022
e150438
fixup! chore: add dependency checks to release scripts
deansheather Jun 13, 2022
449a1a1
chore: make dependency checks nicer
deansheather Jun 14, 2022
ba78076
fixup! chore: make dependency checks nicer
deansheather Jun 14, 2022
a19ef36
fixup! chore: make dependency checks nicer
deansheather Jun 14, 2022
94a6fcd
fixup! chore: make dependency checks nicer
deansheather Jun 14, 2022
c524507
fixup! chore: make dependency checks nicer
deansheather Jun 14, 2022
48eaa18
fixup! chore: make dependency checks nicer
deansheather Jun 14, 2022
ce3f4f5
fixup! chore: make dependency checks nicer
deansheather Jun 14, 2022
4886542
fixup! chore: make dependency checks nicer
deansheather Jun 14, 2022
d4631ad
fixup! chore: make dependency checks nicer
deansheather Jun 14, 2022
a0c9a96
chore: integrate docker into pipeline
deansheather Jun 15, 2022
0907c37
fixup! chore: integrate docker into pipeline
deansheather Jun 15, 2022
4a94e25
fixup! chore: integrate docker into pipeline
deansheather Jun 16, 2022
37badc3
Merge branch 'main' into remove-goreleaser
deansheather Jun 16, 2022
173031f
chore: add version checks to lib.sh
deansheather Jun 16, 2022
ae48f20
fixup! chore: add version checks to lib.sh
deansheather Jun 16, 2022
d8a624c
fixup! chore: add version checks to lib.sh
deansheather Jun 16, 2022
6f2b997
Merge branch 'main' into remove-goreleaser
deansheather Jun 18, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: update release workflow to use new build scripts
  • Loading branch information
deansheather committed Jun 10, 2022
commit 044780d6bf6f6f88606665c9f33e44b7614407e1
178 changes: 138 additions & 40 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,39 +1,95 @@
# GitHub release workflow.
#
# This workflow is a bit complicated because we have to build darwin binaries on
# a mac runner, but the mac runners are extremely slow. So instead of running
# the entire release on a mac (which will take an hour to run), we run only the
# mac build on a mac, and the rest on a linux runner. The final release is then
# published using a final linux runner.
name: release
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
snapshot:
description: Allow a +dev version to be generated, implies dry_run.
type: boolean
required: true
dry_run:
description: Perform a dry-run release.
type: boolean
required: true

# In a non-snapshot we want the ./scripts/version.sh script to never generate a
# +dev version.
env:
CODER_NO_DEV_VERSION: ${{ github.event.inputs.snapshot || 'true' }}

jobs:
goreleaser:
runs-on: macos-latest
env:
# Necessary for Docker manifest
DOCKER_CLI_EXPERIMENTAL: "enabled"
linux-windows:
runs-on: ubuntu-latest
steps:
# Docker is not included on macos-latest
- uses: docker-practice/actions-setup-docker@1.0.10

- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- uses: actions/setup-go@v3
with:
go-version: "~1.18"

- name: Docker Login
uses: docker/login-action@v2
- name: Cache Node
id: cache-node
uses: actions/cache@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
path: |
**/node_modules
.eslintcache
key: js-${{ runner.os }}-test-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
js-${{ runner.os }}-

- name: Build Site
run: make site/out/index.html

- name: Build Slim Binaries
run: make bin

- name: Build Linux and Windows Binaries
run: |
./scripts/build_go_matrix.sh \
--output ./dist/ \
--archive \
--package-linux \
linux:amd64,armv7,arm64 \
windows:amd64,arm64

- name: Upload binary artifacts
uses: actions/upload-artifact@v3
with:
name: linux
path: |
dist/*.zip
dist/*.tar.gz
dist/*.apk
dist/*.deb
dist/*.rpm

# The mac binaries get built on mac runners because they need to be signed,
# and the signing tool only runs on mac. This darwin job only builds the Mac
# binaries and uploads them as job artifacts used by the publish step.
darwin:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: actions/setup-go@v3
with:
go-version: "~1.18"

- name: Install Gon
- name: Install gon
run: |
brew tap mitchellh/gon
brew install mitchellh/gon/gon
Expand All @@ -44,24 +100,6 @@ jobs:
p12-file-base64: ${{ secrets.AC_CERTIFICATE_P12_BASE64 }}
p12-password: ${{ secrets.AC_CERTIFICATE_PASSWORD }}

- name: Echo Go Cache Paths
id: go-cache-paths
run: |
echo "::set-output name=go-build::$(go env GOCACHE)"
echo "::set-output name=go-mod::$(go env GOMODCACHE)"

- name: Go Build Cache
uses: actions/cache@v3
with:
path: ${{ steps.go-cache-paths.outputs.go-build }}
key: ${{ runner.os }}-release-go-build-${{ hashFiles('**/go.sum') }}

- name: Go Mod Cache
uses: actions/cache@v3
with:
path: ${{ steps.go-cache-paths.outputs.go-mod }}
key: ${{ runner.os }}-release-go-mod-${{ hashFiles('**/go.sum') }}

- name: Cache Node
id: cache-node
uses: actions/cache@v3
Expand All @@ -79,12 +117,72 @@ jobs:
- name: Build Site
run: make site/out/index.html

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v3
with:
version: latest
args: release --rm-dist --timeout 60m
- name: Build Slim Binaries
run: make bin

- name: Build darwin Binaries (with signatures)
run: |
./scripts/build_go_matrix.sh \
--output ./dist/ \
--archive \
--sign-darwin \
darwin:amd64,arm64
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
AC_USERNAME: ${{ secrets.AC_USERNAME }}
AC_PASSWORD: ${{ secrets.AC_PASSWORD }}

- name: Upload Binary Artifacts
uses: actions/upload-artifact@v3
with:
name: darwin
path: ./dist/coder_*.zip

publish:
runs-on: ubuntu-latest
needs:
- linux-windows
- darwin
env:
# Necessary for Docker manifest
DOCKER_CLI_EXPERIMENTAL: "enabled"
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Docker Login
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: mkdir artifacts
run: mkdir artifacts

- name: Download darwin Artifacts
uses: actions/download-artifact@v3
with:
name: darwin
path: artifacts

- name: Download Linux and Windows Artifacts
uses: actions/download-artifact@v3
with:
name: linux
path: artifacts

- name: ls artifacts
run: ls artifacts

- name: Publish Release
run: |
./scripts/publish_release.sh \
${{ (github.event.inputs.dry_run || github.event.inputs.snapshot) && '--dry-run' }} \
./artifacts/*.zip \
./artifacts/*.tar.gz \
./artifacts/*.apk \
./artifacts/*.deb \
./artifacts/*.rpm
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.DEFAULT_GOAL := build

# use a single bash shell for each job, and immediately exit on failure
# Use a single bash shell for each job, and immediately exit on failure
SHELL := bash
.SHELLFLAGS = -ceu
.ONESHELL:
Expand All @@ -18,6 +18,7 @@ bin: $(shell find . -not -path './vendor/*' -type f -name '*.go') go.mod go.sum
@echo "== This builds slim binaries for command-line usage."
@echo "== Use \"make build\" to embed the site."

mkdir -p ./dist
rm -rf ./dist/coder-slim_*
./scripts/build_go_slim.sh \
--version "$(VERSION)" \
Expand Down