forked from DazWilkin/updown-exporter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
31 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,65 +2,34 @@ name: build-containers | |
on: | ||
push: | ||
branches: | ||
- master | ||
- main | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
jobs: | ||
vultr-exporter: | ||
build-publish: | ||
name: updown-exporter | ||
runs-on: ubuntu-latest | ||
env: | ||
REPO: dazwilkin/updown-exporter | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Login | ||
|
||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: stable | ||
|
||
- uses: ko-build/[email protected] | ||
|
||
- name: Log in to GHCR | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GHCR }} | ||
- name: Get kernel version | ||
run: echo "VERSION=$(uname --kernel-release)" >> ${GITHUB_ENV} | ||
- name: Exporter | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
build-args: | | ||
TOKEN=${{ secrets.GHCR }} | ||
VERSION=${{ env.VERSION }} | ||
COMMIT=${{ github.sha }} | ||
tags: ghcr.io/${{ env.REPO }}:${{ github.sha }} | ||
push: true | ||
# - name: Cosign installer | ||
# uses: sigstore/cosign-installer@main | ||
# - name: Write signing key to disk (only needed for `cosign sign --key`) | ||
# run: echo "${{ secrets.SIGNING }}" > ./cosign.key | ||
# - name: Sign container image | ||
# run: | | ||
# cosign sign \ | ||
# --key=./cosign.key \ | ||
# --annotations="repo=${{ github.repository }}" \ | ||
# --annotations="workflow=${{ github.workflow }}" \ | ||
# --annotations="commit=${{ github.sha }}" \ | ||
# --annotations="version=${{ env.VERSION }}" \ | ||
# ghcr.io/${{ env.REPO }}:${{ github.sha }} | ||
# env: | ||
# COSIGN_PASSWORD: "" | ||
- name: Revise occurrences of the image | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "GitHub Actions" | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
for FILENAME in "./README.md" | ||
do | ||
echo "Replacing: ${REPO}" | ||
sed \ | ||
--in-place \ | ||
"s|${{ env.REPO }}:[0-9a-f]\{40\}|${{ env.REPO }}:${{ github.sha }}|g" \ | ||
${FILENAME} | ||
git add ${FILENAME} | ||
done | ||
git commit --message "GitHub Actions update image references" | ||
git push origin master | ||
- run: | | ||
ko build --sbom=none --bare . | ||
env: | ||
KO_DOCKER_REPO: ghcr.io/${{ github.repository }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
builds: | ||
- id: updown-exporter | ||
main: . | ||
ldflags: | ||
- -s -w | ||
- -extldflags "-static" | ||
|
||
defaultPlatforms: | ||
- linux/arm64 | ||
- linux/amd64 |
This file was deleted.
Oops, something went wrong.