-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: PoAn Yang <[email protected]>
- Loading branch information
1 parent
a108f98
commit ee904c2
Showing
6 changed files
with
107 additions
and
32 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 |
---|---|---|
@@ -0,0 +1,66 @@ | ||
name: build | ||
on: | ||
push: | ||
branches: | ||
- master | ||
- v* | ||
tags: | ||
- v* | ||
pull_request: | ||
jobs: | ||
build: | ||
name: Build images | ||
runs-on: ubuntu-latest | ||
container: | ||
image: rancher/dapper:v0.6.0 | ||
steps: | ||
# Git is not in Dapper container image. Add it manually for dirty check. | ||
- name: Add Git | ||
run: apk add -U git | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Declare branch | ||
run: | | ||
echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> "$GITHUB_ENV" | ||
# For multi-platform support | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
# Build binaries | ||
- name: Run dapper ci | ||
run: dapper ci | ||
- name: Copy bin folder to package | ||
run: | | ||
cp -r ./bin/* ./package/ | ||
- name: Login to Docker Hub | ||
if: ${{ startsWith(github.ref, 'refs/heads/') || startsWith(github.ref, 'refs/tags/') }} | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
# rancher/terraform-provider-harvester image | ||
- name: docker-publish | ||
if: ${{ startsWith(github.ref, 'refs/heads/') }} | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: package/ | ||
push: true | ||
platforms: linux/amd64,linux/arm64 | ||
tags: rancher/terraform-provider-harvester:${{ env.branch }}-head | ||
file: package/Dockerfile | ||
- name: docker-publish-with-tag | ||
if: ${{ startsWith(github.ref, 'refs/tags/') }} | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: package/ | ||
push: true | ||
platforms: linux/amd64,linux/arm64 | ||
tags: rancher/terraform-provider-harvester:${{ github.ref_name }} | ||
file: package/Dockerfile | ||
build-args: | | ||
VERSION=${{ github.ref_name }} |
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 |
---|---|---|
|
@@ -10,11 +10,14 @@ RUN zypper -n rm container-suseconnect && \ | |
RUN GO111MODULE=on go install golang.org/x/tools/cmd/[email protected] | ||
|
||
## install golangci-lint | ||
RUN if [ "${ARCH}" = "amd64" ]; then \ | ||
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.57.1; \ | ||
fi | ||
RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.57.1 | ||
|
||
ENV DAPPER_ENV REPO TAG DRONE_TAG CROSS | ||
# The docker version in dapper is too old to have buildx. Install it manually. | ||
RUN wget https://github.com/docker/buildx/releases/download/v0.13.1/buildx-v0.13.1.linux-${ARCH} && \ | ||
chmod +x buildx-v0.13.1.linux-${ARCH} && \ | ||
mv buildx-v0.13.1.linux-${ARCH} /usr/local/bin/buildx | ||
|
||
ENV DAPPER_ENV REPO TAG DRONE_TAG | ||
ENV DAPPER_SOURCE /go/src/github.com/harvester/terraform-provider-harvester | ||
ENV DAPPER_OUTPUT ./bin ./dist | ||
ENV DAPPER_DOCKER_SOCKET true | ||
|
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
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
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
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