Update README.md #1585
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: Build | |
on: | |
schedule: | |
# https://docs.github.com/en/actions/reference/events-that-trigger-workflows#scheduled-events | |
# > Note: The schedule event can be delayed during periods of high loads of GitHub Actions workflow runs. | |
# > High load times include the start of every hour. To decrease the chance of delay, schedule your workflow to run at a different time of the hour. | |
- cron: "48 2 * * *" | |
# For weekly autoreleases | |
# TODO https://github.com/AlekSi/golang-tip/issues/5 | |
# - cron: '48 1 * * 0' | |
push: | |
branches: | |
- main | |
pull_request: | |
paths-ignore: ["**.md"] | |
jobs: | |
docker: | |
name: Docker (${{ matrix.branch }}) | |
timeout-minutes: 60 | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-22.04 | |
branch: | |
- master | |
- release-branch.go1.24 | |
- release-branch.go1.23 | |
- release-branch.go1.22 | |
runs-on: ${{ matrix.os }} | |
env: | |
GO_BRANCH: ${{ matrix.branch }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Login into Docker registries | |
if: github.event_name != 'pull_request' | |
run: | | |
docker login --username aleksi --password ${{ secrets.DOCKERHUB_TOKEN }} | |
docker login ghcr.io --username aleksi --password ${{ secrets.GITHUB_TOKEN }} | |
- name: Start BuildKit builder | |
run: make docker-up | |
- name: Build Docker images for PR | |
if: github.event_name == 'pull_request' | |
run: make docker-build | |
- name: Build Docker images for Docker Hub | |
if: github.event_name != 'pull_request' | |
run: make docker-build | |
env: | |
DOCKER_PLATFORM: linux/amd64,linux/arm64 | |
DOCKER_OUTPUT: type=image,push=true,annotation-index.org.opencontainers.image.description="Daily builds of active Go development branches (branch ${{ env.GO_BRANCH }})" | |
DOCKER_TAG: aleksi/golang-tip:${{ env.GO_BRANCH }} | |
- name: Build Docker images for ghcr.io | |
if: github.event_name != 'pull_request' | |
run: make docker-build | |
env: | |
DOCKER_PLATFORM: linux/amd64,linux/arm64 | |
DOCKER_OUTPUT: type=image,push=true,annotation-index.org.opencontainers.image.description="Daily builds of active Go development branches (branch ${{ env.GO_BRANCH }})" | |
DOCKER_TAG: ghcr.io/aleksi/golang-tip:${{ env.GO_BRANCH }} | |
# skip push for PRs | |
# move to `publish` job | |
# TODO https://github.com/AlekSi/golang-tip/issues/8 | |
targz: | |
name: TarGz (${{ matrix.branch }}, ${{ matrix.os }}, ${{ matrix.goroot }}) | |
timeout-minutes: 10 | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-22.04 | |
- macos-13 | |
- macos-15 | |
branch: | |
- master | |
- release-branch.go1.24 | |
- release-branch.go1.23 | |
- release-branch.go1.22 | |
goroot: | |
- /usr/local/go | |
- /tmp/golang-tip | |
runs-on: ${{ matrix.os }} | |
env: | |
GO_BRANCH: ${{ matrix.branch }} | |
GOROOT_FINAL: ${{ matrix.goroot }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
cache: false | |
- name: Build .tar.gz file | |
run: make targz-build | |
- name: Set artifact suffix | |
if: startsWith(env.GOROOT_FINAL, '/tmp/') | |
run: | | |
echo ARTIFACT_SUFFIX=.tmp >> $GITHUB_ENV | |
- name: Set artifact name | |
run: | | |
echo ARTIFACT_NAME=${{ env.GO_BRANCH }}.$(go env GOOS)-$(go env GOARCH)${{ env.ARTIFACT_SUFFIX }} >> $GITHUB_ENV | |
- name: Rename artifact | |
run: mv golang-tip.tar.gz ${{ env.ARTIFACT_NAME }}.tar.gz | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.ARTIFACT_NAME }} | |
path: ${{ env.ARTIFACT_NAME }}.tar.gz | |
if-no-files-found: error | |
publish: | |
name: Publish | |
needs: [docker, targz] | |
timeout-minutes: 10 | |
runs-on: ubuntu-22.04 | |
if: github.actor != 'dependabot[bot]' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
- name: Prepare files | |
run: | | |
go version | |
go run tipper.go all | |
- name: Publish artifacts | |
if: github.event_name != 'pull_request' | |
uses: marvinpinto/[email protected] | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
automatic_release_tag: tip | |
title: tip | |
prerelease: false | |
draft: false | |
files: | | |
**.tar.gz | |
*.txt | |
- name: Publish PR artifacts | |
if: github.event_name == 'pull_request' | |
uses: marvinpinto/[email protected] | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
automatic_release_tag: test | |
title: Test release by pull request; do not use | |
prerelease: true | |
draft: false | |
files: | | |
**.tar.gz | |
*.txt |