-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update gha: use one binary in docker image and targball; Rollback Makefile changes;
- Loading branch information
Showing
3 changed files
with
51 additions
and
26 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 |
---|---|---|
|
@@ -3,9 +3,21 @@ name: Make release | |
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
make_release_draft: | ||
description: Create release draft | ||
default: true | ||
type: boolean | ||
required: true | ||
build_dockerimage: | ||
description: Build docker images and push to docker hub | ||
default: true | ||
type: boolean | ||
required: true | ||
push: | ||
tags: | ||
- 'v*' | ||
|
||
|
||
jobs: | ||
build_release: | ||
|
@@ -24,27 +36,43 @@ jobs: | |
- name: Make tarballs | ||
run: make tarballs | ||
|
||
- name: Upload files to release | ||
- name: Upload files to release and create draft | ||
# if: ${{ inputs.make_release_draft }} | ||
run: make release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Cache artifacts | ||
uses: actions/cache@v3 | ||
with: | ||
path: .build | ||
key: syncthing_exporter-${{ github.sha }} | ||
|
||
build_dockerimage: | ||
# if: ${{ inputs.build_dockerimage }} | ||
needs: build_release | ||
name: Build docker images | ||
runs-on: ubuntu-20.04 | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
|
||
- name: Checkout code | ||
uses: actions/[email protected] | ||
|
||
- name: Set VERSION as environment variable | ||
run: echo "VERSION=$(cat VERSION)" >> $GITHUB_ENV | ||
|
||
- name: Cache artifacts | ||
uses: actions/cache@v3 | ||
with: | ||
path: .build | ||
key: syncthing_exporter-${{ github.sha }} | ||
|
||
- name: Set up QEMU | ||
uses: docker/[email protected] | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/[email protected] | ||
|
||
- name: Set VERSION as environment variable | ||
run: echo "VERSION=$(cat VERSION)" >> $GITHUB_ENV | ||
|
||
- name: Login to DockerHub | ||
uses: docker/[email protected] | ||
with: | ||
|
@@ -57,6 +85,9 @@ jobs: | |
context: . | ||
platforms: linux/amd64,linux/arm64,linux/386,linux/arm/v6,linux/arm/v7 | ||
push: true | ||
target: ghactions | ||
tags: | | ||
${{ secrets.DOCKERHUB_USERNAME }}/syncthing_exporter:latest, | ||
${{ secrets.DOCKERHUB_USERNAME }}/syncthing_exporter:${{ env.VERSION }} | ||
f100024/syncthing_exporter:latest, | ||
f100024/syncthing_exporter:${{ env.VERSION }} | ||
env: | ||
DOCKER_BUILDKIT: 1 |
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 |
---|---|---|
@@ -1,12 +1,18 @@ | ||
FROM golang:1.19 as builder | ||
|
||
COPY . /builddir | ||
WORKDIR /builddir | ||
|
||
RUN make build | ||
|
||
FROM alpine:3.17 | ||
FROM alpine:3.17 as local | ||
COPY --from=builder /builddir/syncthing_exporter /usr/bin/syncthing_exporter | ||
|
||
EXPOSE 9093 | ||
ENTRYPOINT ["syncthing_exporter"] | ||
|
||
FROM alpine:3.17 as ghactions | ||
ARG TARGETOS TARGETARCH TARGETVARIANT | ||
COPY .build/${TARGETOS}-${TARGETARCH}${TARGETVARIANT}/syncthing_exporter /usr/bin/syncthing_exporter | ||
|
||
EXPOSE 9093 | ||
ENTRYPOINT ["syncthing_exporter"] |
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