Skip to content

Commit

Permalink
bump Go to 1.21, compress, push tag attachments
Browse files Browse the repository at this point in the history
This only builds for PRs and drops the artifact upload, and publishes
attachements for tags instead, so that each individual file can be
downloaded from a release page on GitHub.
We should figure out if we can share the u-root commit to use between
the two actions, or find some other solution.

Signed-off-by: Daniel Maslowski <[email protected]>
  • Loading branch information
orangecms committed Dec 12, 2023
1 parent c287f3d commit 5841ae2
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 9 deletions.
14 changes: 5 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: u-root-builder
name: u-root-buildcheck

on:
push:
Expand All @@ -7,7 +7,6 @@ on:
branches: [ "main" ]

jobs:

build:
strategy:
matrix:
Expand All @@ -23,14 +22,11 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.20'
go-version: '1.21'

- name: Build
run: |
go build .
GOARCH=${{ matrix.arch }} ./u-root -uroot-source . -o u-root-${{ matrix.arch }}-${{ matrix.template }}.cpio ${{ matrix.template }}
- name: Upload
uses: actions/[email protected]
with:
path: u-root-${{ matrix.arch }}-${{ matrix.template }}.cpio
GOARCH=${{ matrix.arch }} ./u-root -uroot-source . \
-o u-root-${{ matrix.arch }}-${{ matrix.template }}.cpio \
${{ matrix.template }}
44 changes: 44 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: u-root-publish

on:
push:
tags:
- '*'

jobs:
publish:
strategy:
matrix:
template: [core, all, embedded, minimal]
arch: [amd64, arm, arm64, riscv64]

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
repository: u-root/u-root

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.21'

- name: Build
run: |
go build .
GOARCH=${{ matrix.arch }} ./u-root -uroot-source . \
-o ${{ matrix.arch }}-${{ matrix.template }}.cpio \
${{ matrix.template }}
xz --check=crc32 -9 --lzma2=dict=1MiB \
--stdout ${{ matrix.arch }}-${{ matrix.template }}.cpio | \
dd conv=sync bs=512 \
of=${{ matrix.arch }}-${{ matrix.template }}.cpio.xz
- name: Upload
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }}
file: ${{ matrix.arch }}-${{ matrix.template }}.cpio.xz
asset_name: u-root_${{ matrix.arch }}_${{ matrix.template }}.cpio.xz

0 comments on commit 5841ae2

Please sign in to comment.