Skip to content

Commit

Permalink
Merge pull request #81 from tailscale/awly/build-old-releases
Browse files Browse the repository at this point in the history
.github/workflows/build: support re-building old releases
  • Loading branch information
awly committed Jan 5, 2024
2 parents 7592922 + 2501e61 commit d378d4c
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,21 @@ on:
pull_request:
branches:
- '*'
workflow_dispatch:
inputs:
ref:
description: Branch, commit or tag to build from
required: true
default: 'tailscale.go1.21'

jobs:
test:
runs-on: ubuntu-20.04
steps:
- name: checkout
uses: actions/checkout@v3
with:
ref: ${{ inputs.ref || github.ref }}
- name: test
run: cd src && ./all.bash

Expand All @@ -27,10 +35,12 @@ jobs:
GOOS: ["linux", "darwin"]
GOARCH: ["amd64", "arm64"]
runs-on: ubuntu-20.04
if: github.event_name == 'push'
if: contains(fromJSON('["push", "workflow_dispatch"]'), github.event_name)
steps:
- name: checkout
uses: actions/checkout@v3
with:
ref: ${{ inputs.ref || github.ref }}
- name: build
run: cd src && ./make.bash
env:
Expand All @@ -57,7 +67,7 @@ jobs:

create_release:
runs-on: ubuntu-20.04
if: github.event_name == 'push'
if: contains(fromJSON('["push", "workflow_dispatch"]'), github.event_name)
needs: [test, build_release]
outputs:
url: ${{ steps.create_release.outputs.upload_url }}
Expand All @@ -80,7 +90,7 @@ jobs:
GOOS: ["linux", "darwin"]
GOARCH: ["amd64", "arm64"]
runs-on: ubuntu-20.04
if: github.event_name == 'push'
if: contains(fromJSON('["push", "workflow_dispatch"]'), github.event_name)
needs: [create_release]
steps:
- name: download artifact
Expand All @@ -99,10 +109,14 @@ jobs:

clean_old:
runs-on: ubuntu-20.04
# Do not clean up old builds on workflow_dispatch to allow temporarily
# re-creating old releases for backports.
if: github.event_name == 'push'
needs: [upload_release]
steps:
- name: checkout
uses: actions/checkout@v3
with:
ref: ${{ inputs.ref || github.ref }}
- name: Delete older builds
run: ./.github/workflows/prune_old_builds.sh "${{ secrets.GITHUB_TOKEN }}"

0 comments on commit d378d4c

Please sign in to comment.