Skip to content

Commit f04d38a

Browse files
committed
.github/workflows: build and release source tarball
Fixes #401
1 parent 52338c2 commit f04d38a

File tree

1 file changed

+30
-4
lines changed

1 file changed

+30
-4
lines changed

.github/workflows/build.yml

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,38 @@ jobs:
6565
- name: Upload workflow artifacts
6666
uses: actions/upload-artifact@v4
6767
with:
68-
name: age-binaries-${{ matrix.GOOS }}-${{ matrix.GOARCH }}
68+
name: age-artifacts-${{ matrix.GOOS }}-${{ matrix.GOARCH }}
6969
path: age-*
70+
source:
71+
name: Package source code
72+
runs-on: ubuntu-latest
73+
steps:
74+
- name: Checkout repository
75+
uses: actions/checkout@v5
76+
with:
77+
fetch-depth: 0
78+
persist-credentials: false
79+
- name: Install Go
80+
uses: actions/setup-go@v5
81+
with:
82+
go-version: 1.x
83+
cache: false
84+
- name: Create vendor directory
85+
run: go mod vendor
86+
- name: Create source tarball
87+
run: |
88+
VERSION="$(git describe --tags)"
89+
# ignore . files
90+
tar --exclude='./.*' -cvzf "age-$VERSION-source.tar.gz" .
91+
- name: Upload workflow artifacts
92+
uses: actions/upload-artifact@v4
93+
with:
94+
name: age-artifacts-source
95+
path: age-*-source.tar.gz
7096
upload:
71-
name: Upload and attest release binaries
97+
name: Upload and attest release artifacts
7298
if: github.event_name == 'release'
73-
needs: build
99+
needs: [build, source]
74100
permissions:
75101
contents: write
76102
attestations: write
@@ -80,7 +106,7 @@ jobs:
80106
- name: Download workflow artifacts
81107
uses: actions/download-artifact@v4
82108
with:
83-
pattern: age-binaries-*
109+
pattern: age-artifacts-*
84110
merge-multiple: true
85111
- name: Generate artifacts attestation
86112
uses: actions/attest-build-provenance@v3

0 commit comments

Comments
 (0)