Skip to content

Commit 535769c

Browse files
committed
Updated GitHub Actions workflows to support tag-based triggers and version handling
1 parent 077ad91 commit 535769c

4 files changed

Lines changed: 36 additions & 8 deletions

File tree

.github/workflows/build_lean.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44
push:
55
branches:
66
- main
7+
tags:
8+
- "v*"
79
paths:
810
- "lean/**"
911
- ".github/workflows/build_lean.yml"
@@ -18,6 +20,10 @@ on:
1820
required: false
1921
default: false
2022
type: boolean
23+
version:
24+
description: "Version tag to apply (e.g. v0.0.1)"
25+
required: false
26+
type: string
2127
repository_dispatch:
2228
types: [trigger-build]
2329

@@ -42,7 +48,7 @@ jobs:
4248
fetch-depth: 0
4349

4450
- name: Set up QEMU
45-
if: github.ref_name == github.event.repository.default_branch
51+
if: github.ref_name == github.event.repository.default_branch || github.ref_type == 'tag'
4652
uses: docker/setup-qemu-action@v3
4753

4854
- name: Set up Docker Buildx (QEMU)
@@ -66,6 +72,7 @@ jobs:
6672
type=ref,event=branch
6773
type=ref,event=tag
6874
type=ref,event=pr
75+
type=raw,value=${{ inputs.version }},enable=${{ inputs.version != '' }}
6976
type=raw,value=${{ matrix.lean_version }},suffix=,enable={{is_default_branch}}
7077
type=raw,value=latest,suffix=,enable=${{ github.ref_name == github.event.repository.default_branch && matrix.lean_version == '4.7.0' }}
7178
type=edge,branch=main
@@ -77,7 +84,7 @@ jobs:
7784
with:
7885
context: lean
7986
pull: true
80-
push: ${{ !(github.event_name == 'push' && github.ref_name != github.event.repository.default_branch) }}
87+
push: ${{ !(github.event_name == 'push' && github.ref_type != 'tag' && github.ref_name != github.event.repository.default_branch) }}
8188
platforms: ${{ (github.ref_type == 'tag' || github.ref_name == github.event.repository.default_branch) && 'linux/amd64,linux/arm64' || 'linux/amd64' }}
8289
provenance: false
8390
tags: ${{ steps.meta.outputs.tags }}

.github/workflows/build_python.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44
push:
55
branches:
66
- main
7+
tags:
8+
- "v*"
79
paths:
810
- "python/**"
911
- ".github/workflows/build_python.yml"
@@ -18,6 +20,10 @@ on:
1820
required: false
1921
default: false
2022
type: boolean
23+
version:
24+
description: "Version tag to apply (e.g. v0.0.1)"
25+
required: false
26+
type: string
2127
repository_dispatch:
2228
types: [trigger-build]
2329

@@ -42,7 +48,7 @@ jobs:
4248
fetch-depth: 0
4349

4450
- name: Set up QEMU
45-
if: github.ref_name == github.event.repository.default_branch
51+
if: github.ref_name == github.event.repository.default_branch || github.ref_type == 'tag'
4652
uses: docker/setup-qemu-action@v3
4753

4854
- name: Set up Docker Buildx (QEMU)
@@ -66,6 +72,7 @@ jobs:
6672
type=ref,event=branch
6773
type=ref,event=tag
6874
type=ref,event=pr
75+
type=raw,value=${{ inputs.version }},enable=${{ inputs.version != '' }}
6976
type=raw,value=${{ matrix.python_version }},suffix=,enable={{is_default_branch}}
7077
type=raw,value=latest,suffix=,enable=${{ github.ref_name == github.event.repository.default_branch && matrix.python_version == '3.12' }}
7178
type=edge,branch=main
@@ -77,7 +84,7 @@ jobs:
7784
with:
7885
context: python
7986
pull: true
80-
push: ${{ !(github.event_name == 'push' && github.ref_name != github.event.repository.default_branch) }}
87+
push: ${{ !(github.event_name == 'push' && github.ref_type != 'tag' && github.ref_name != github.event.repository.default_branch) }}
8188
platforms: ${{ (github.ref_type == 'tag' || github.ref_name == github.event.repository.default_branch) && 'linux/amd64,linux/arm64' || 'linux/amd64' }}
8289
provenance: false
8390
tags: ${{ steps.meta.outputs.tags }}

.github/workflows/build_scratch.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44
push:
55
branches:
66
- main
7+
tags:
8+
- "v*"
79
paths:
810
- "scratch/**"
911
- ".github/workflows/build_scratch.yml"
@@ -18,6 +20,10 @@ on:
1820
required: false
1921
default: false
2022
type: boolean
23+
version:
24+
description: "Version tag to apply (e.g. v0.0.1)"
25+
required: false
26+
type: string
2127
repository_dispatch:
2228
types: [trigger-build]
2329

@@ -42,7 +48,7 @@ jobs:
4248
fetch-depth: 0
4349

4450
- name: Set up QEMU
45-
if: github.ref_name == github.event.repository.default_branch
51+
if: github.ref_name == github.event.repository.default_branch || github.ref_type == 'tag'
4652
uses: docker/setup-qemu-action@v3
4753

4854
- name: Set up Docker Buildx (QEMU)
@@ -66,6 +72,7 @@ jobs:
6672
type=ref,event=branch
6773
type=ref,event=tag
6874
type=ref,event=pr
75+
type=raw,value=${{ inputs.version }},enable=${{ inputs.version != '' }}
6976
type=raw,value=${{ matrix.debian_version }},suffix=,enable={{is_default_branch}}
7077
type=raw,value=latest,suffix=,enable=${{ github.ref_name == github.event.repository.default_branch && matrix.debian_version == 'bookworm' }}
7178
type=edge,branch=main
@@ -77,7 +84,7 @@ jobs:
7784
with:
7885
context: scratch
7986
pull: true
80-
push: ${{ !(github.event_name == 'push' && github.ref_name != github.event.repository.default_branch) }}
87+
push: ${{ !(github.event_name == 'push' && github.ref_type != 'tag' && github.ref_name != github.event.repository.default_branch) }}
8188
platforms: ${{ (github.ref_type == 'tag' || github.ref_name == github.event.repository.default_branch) && 'linux/amd64,linux/arm64' || 'linux/amd64' }}
8289
provenance: false
8390
tags: ${{ steps.meta.outputs.tags }}

.github/workflows/build_wolfram.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44
push:
55
branches:
66
- main
7+
tags:
8+
- "v*"
79
paths:
810
- "wolfram/**"
911
- ".github/workflows/build_wolfram.yml"
@@ -18,6 +20,10 @@ on:
1820
required: false
1921
default: false
2022
type: boolean
23+
version:
24+
description: "Version tag to apply (e.g. v0.0.1)"
25+
required: false
26+
type: string
2127
repository_dispatch:
2228
types: [trigger-build]
2329

@@ -42,7 +48,7 @@ jobs:
4248
fetch-depth: 0
4349

4450
- name: Set up QEMU
45-
if: github.ref_name == github.event.repository.default_branch
51+
if: github.ref_name == github.event.repository.default_branch || github.ref_type == 'tag'
4652
uses: docker/setup-qemu-action@v3
4753

4854
- name: Set up Docker Buildx (QEMU)
@@ -66,6 +72,7 @@ jobs:
6672
type=ref,event=branch
6773
type=ref,event=tag
6874
type=ref,event=pr
75+
type=raw,value=${{ inputs.version }},enable=${{ inputs.version != '' }}
6976
type=raw,value=${{ matrix.wolfram_version }},suffix=,enable={{is_default_branch}}
7077
type=raw,value=latest,suffix=,enable=${{ github.ref_name == github.event.repository.default_branch && matrix.wolfram_version == '14.1' }}
7178
type=edge,branch=main
@@ -77,7 +84,7 @@ jobs:
7784
with:
7885
context: wolfram
7986
pull: true
80-
push: ${{ !(github.event_name == 'push' && github.ref_name != github.event.repository.default_branch) }}
87+
push: ${{ !(github.event_name == 'push' && github.ref_type != 'tag' && github.ref_name != github.event.repository.default_branch) }}
8188
platforms: ${{ (github.ref_type == 'tag' || github.ref_name == github.event.repository.default_branch) && 'linux/amd64,linux/arm64' || 'linux/amd64' }}
8289
provenance: false
8390
tags: ${{ steps.meta.outputs.tags }}

0 commit comments

Comments
 (0)