diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..fe0180c --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,54 @@ +name: release + +on: + push: + tags: + - 'v*' + +jobs: + release-docker: + runs-on: ubuntu-latest + env: + DOCKER_CLI_EXPERIMENTAL: "enabled" + steps: + - + name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - + name: Docker meta + id: meta + uses: crazy-max/ghaction-docker-meta@v2 + with: + images: | + 1password/onepassword-operator + # Publish image for x.y.z and x.y + # The latest tag is automatically added for semver tags + tags: | + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + - + name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - + name: Docker Login + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - + name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + file: Dockerfile + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + build-args: | + operator_version=${{ github.event.ref }} diff --git a/Dockerfile b/Dockerfile index 5d1df61..ce8e25f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,8 +14,6 @@ COPY vendor/ vendor/ # Build ARG operator_version=dev RUN CGO_ENABLED=0 \ - GOOS=linux \ - GOARCH=amd64 \ GO111MODULE=on \ go build \ -ldflags "-X version.Version=$operator_version" \