Skip to content

Commit

Permalink
chore: add windows release
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeagle committed Sep 17, 2024
1 parent 18e978c commit aebeecd
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 25 deletions.
8 changes: 1 addition & 7 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,7 @@ import %workspace%/.aspect/bazelrc/javascript.bazelrc
import %workspace%/.aspect/bazelrc/performance.bazelrc

### YOUR PROJECT SPECIFIC OPTIONS GO HERE ###

# Allow our init template folders to contain BUILD.bazel without it being a subpackage
# To update, run:
# find pkg/aspect/init/template -type d | paste -d, -s - | awk '{ print "common --deleted_packages="$1 }'
common --deleted_packages=pkg/aspect/init/template,pkg/aspect/init/template/tools,pkg/aspect/init/template/tools/format

common --workspace_status_command "${PWD}/workspace_status.sh"
common --workspace_status_command "${PWD}/tools/workspace_status.sh"

common:release -c opt --stamp

Expand Down
53 changes: 53 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: build
on:
push:
branches: ['main']
pull_request:
workflow_call:
outputs:
windows:
description: 'Windows binaries'
value: ${{jobs.build_windows.outputs.artifact}}
linux:
description: 'Linux and MacOS binaries'
value: ${{jobs.build.outputs.artifact}}
jobs:
build:
name: darwin and linux
runs-on: ubuntu-latest
outputs:
artifact: ${{steps.upload.outputs.artifact-url}}
steps:
- uses: actions/checkout@v4
- run: |
bazel run --config=release //release -- /tmp/aspect/release
- uses: actions/upload-artifact@v4
id: upload
with:
name: linux
retention-days: 1
path: /tmp/aspect/release
# Cross-compiling to Windows is too hard. Just build on a windows runner instead.
build_windows:
name: windows
runs-on: windows-2022
outputs:
artifact: ${{steps.upload.outputs.artifact-url}}
steps:
- uses: actions/checkout@v4
# Bootstrap: the first time we release for windows, we don't have a windows version of Aspect CLI to build with
# So use environment variables to defeat the .bazeliskrc file.
- run: |
cmd /V /C "set USE_BAZEL_VERSION=7.2.1&& \
set BAZELISK_BASE_URL=https://github.com/bazelbuild/bazel/releases/download&& \
bazel build cmd/aspect"
- run: cp $(bazel cquery --output=files cmd/aspect) aspect_windows_amd64.exe
- name: smoke test
run: |
aspect_windows_amd64.exe --help
- uses: actions/upload-artifact@v4
id: upload
with:
name: windows
retention-days: 1
path: aspect_windows_amd64.exe
35 changes: 17 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,31 @@
name: Release
on:
pull_request:
push:
tags:
- '5.*.*'
jobs:
build:
build_all:
uses: ./.github/workflows/build.yaml
release:
runs-on: ubuntu-latest
needs: build_all
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build release artifacts
run: |
if [ -n "$(git status --porcelain)" ]; then
>&2 echo "ERROR: the git state is not clean, aborting build..."
exit 1
fi
rm -rf /tmp/aspect/release
bazel run --config=release //release -- /tmp/aspect/release
if /tmp/aspect/release/aspect-linux_amd64 version | grep '(with local changes)'; then
>&2 echo "ERROR: the release contained changes in the git state and the release will not be produced"
exit 1
fi
- uses: actions/download-artifact@v4
with:
merge-multiple: true
- run: shasum -a 256 aspect* > SHA256.txt
- name: Prepare workspace snippet
run: .github/workflows/install_snippet.sh > release_notes.txt
- name: Create GitHub draft release and upload artifacts
uses: softprops/action-gh-release@v1
- run: ls -alF .
# Disabled during testing
- if: false
name: Create GitHub draft release and upload artifacts
uses: softprops/action-gh-release@v2
with:
# Use GH feature to populate the changelog automatically
generate_release_notes: true
body_path: release_notes.txt
files: /tmp/aspect/release/*
files: |
aspect*
SHA256.txt
File renamed without changes.

0 comments on commit aebeecd

Please sign in to comment.