2021-04-27 21:41:07 +08:00
|
|
|
name: Use Action
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2023-07-11 17:36:11 +08:00
|
|
|
branches:
|
|
|
|
- 'main'
|
2021-04-27 21:41:07 +08:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
use-action:
|
|
|
|
name: Use Action
|
2023-07-11 17:36:11 +08:00
|
|
|
|
2021-04-29 10:56:10 +08:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2023-07-11 17:36:11 +08:00
|
|
|
platform:
|
|
|
|
- ubuntu-latest
|
|
|
|
- macos-latest
|
|
|
|
|
2021-04-29 10:56:10 +08:00
|
|
|
runs-on: ${{ matrix.platform }}
|
|
|
|
|
2021-04-27 21:41:07 +08:00
|
|
|
steps:
|
2024-03-28 00:22:33 +08:00
|
|
|
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
|
2021-04-27 21:41:07 +08:00
|
|
|
with:
|
2024-03-28 00:50:09 +08:00
|
|
|
go-version: '1.22'
|
2023-07-11 17:36:11 +08:00
|
|
|
check-latest: 'true'
|
|
|
|
|
2024-04-20 00:50:57 +08:00
|
|
|
- uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
|
2021-04-27 21:41:07 +08:00
|
|
|
|
|
|
|
# Minimal publish
|
2023-01-13 05:43:19 +08:00
|
|
|
- uses: ko-build/setup-ko@main
|
2023-07-11 17:36:11 +08:00
|
|
|
|
2021-04-27 21:41:07 +08:00
|
|
|
- run: ko publish --bare ./
|
|
|
|
|
2021-05-01 10:33:35 +08:00
|
|
|
- name: Install old release
|
2023-01-13 05:43:19 +08:00
|
|
|
uses: ko-build/setup-ko@main
|
2021-04-27 21:41:07 +08:00
|
|
|
with:
|
|
|
|
version: v0.8.0
|
2023-07-11 17:36:11 +08:00
|
|
|
|
2021-04-27 21:41:07 +08:00
|
|
|
- name: Check installed version
|
|
|
|
run: ko version | grep 0.8.0
|
|
|
|
|
2021-05-01 10:33:35 +08:00
|
|
|
- name: Install from tip
|
2023-01-13 05:43:19 +08:00
|
|
|
uses: ko-build/setup-ko@main
|
2021-04-27 21:41:07 +08:00
|
|
|
with:
|
|
|
|
version: tip
|
2023-07-11 17:36:11 +08:00
|
|
|
|
2021-04-27 21:41:07 +08:00
|
|
|
- name: Check installed version (tip)
|
|
|
|
run: |
|
|
|
|
sudo rm /usr/local/bin/ko # Uninstall previous versions.
|
|
|
|
ko version
|
2021-05-01 10:33:35 +08:00
|
|
|
|
|
|
|
# If KO_DOCKER_REPO is set during setup, it's set for future steps.
|
|
|
|
- name: Pre-set KO_DOCKER_REPO
|
2023-01-13 05:43:19 +08:00
|
|
|
uses: ko-build/setup-ko@main
|
2021-05-01 10:33:35 +08:00
|
|
|
env:
|
|
|
|
KO_DOCKER_REPO: already-set
|
2023-07-11 17:36:11 +08:00
|
|
|
|
2021-05-01 10:33:35 +08:00
|
|
|
- name: Check pre-set KO_DOCKER_REPO
|
|
|
|
run: |
|
2021-05-01 10:42:32 +08:00
|
|
|
if [[ "${KO_DOCKER_REPO}" != "already-set" ]]; then
|
2021-05-01 10:33:35 +08:00
|
|
|
echo "${KO_DOCKER_REPO} != already-set"
|
|
|
|
exit 1
|
|
|
|
fi
|