This repository has been archived by the owner on Aug 16, 2024. It is now read-only.
Update actions/checkout action to v4 #251
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: CI | |
on: | |
- push | |
- pull_request | |
jobs: | |
x86_64-macos: | |
runs-on: macos-latest | |
# We want to run on external PRs, but not on our own internal PRs as they'll be run by the push | |
# to the branch. | |
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository | |
permissions: | |
contents: write # for release creation | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Zig | |
run: | | |
brew install xz | |
sudo sh -c 'wget -c https://ziglang.org/builds/zig-macos-x86_64-0.10.0-dev.2439+c84f5a5f9.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin' | |
- name: Install dependencies | |
run: | | |
brew install go-task/tap/go-task | |
brew uninstall [email protected] | |
brew install [email protected] | |
task setup | |
- name: Run tests | |
run: task test | |
- name: Cross-compile for every OS | |
run: task cross-compile | |
- name: Record latest release version | |
id: recorded_release_version | |
run: echo "::set-output name=commit::$(git log --oneline | head -n1 | cut -d " " -f1)" | |
- name: Release | |
if: success() && github.ref == 'refs/heads/main' && github.event_Name == 'push' && github.repository == 'sourcegraph/doctree' | |
run: | | |
export RELEASE_NAME="$(date +%Y-%m-%d)-$RELEASE_COMMIT" | |
gh release create "release-$RELEASE_NAME" --title "Release of main @ $RELEASE_COMMIT" | |
gh release upload "release-$RELEASE_NAME" out/doctree-aarch64-macos | |
gh release upload "release-$RELEASE_NAME" out/doctree-x86_64-linux | |
gh release upload "release-$RELEASE_NAME" out/doctree-x86_64-macos | |
gh release upload "release-$RELEASE_NAME" out/doctree-x86_64-windows.exe | |
env: | |
RELEASE_COMMIT: ${{steps.recorded_release_version.outputs.commit}} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |