diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index da72299..0000000 --- a/.drone.yml +++ /dev/null @@ -1,62 +0,0 @@ -workspace: - base: /go - path: src/github.com/uswitch/hermod - -pipeline: - test: - image: golang:1.18 - commands: - - GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go test -v -cover $(go list ./...) - build: - image: golang:1.18 - commands: - - make build - - docker-latest-public: - image: plugins/docker - repo: quay.io/uswitch/hermod - registry: quay.io - secrets: [ docker_username, docker_password ] - tags: - - latest - - ${DRONE_COMMIT_SHA} - when: - event: push - branch: main - - docker-tagged-public: - image: plugins/docker - repo: quay.io/uswitch/hermod - registry: quay.io - secrets: [ docker_username, docker_password ] - tags: - - ${DRONE_TAG} - when: - event: tag - - docker-latest: - image: plugins/docker - repo: registry.usw.co/cloud/hermod - tags: - - latest - - ${DRONE_COMMIT_SHA} - when: - event: push - branch: main - - docker-tagged: - image: plugins/docker - repo: registry.usw.co/cloud/hermod - tags: - - ${DRONE_TAG} - when: - event: tag - - docker-test: - image: plugins/docker - when: - event: push - repo: registry.usw.co/cloud/hermod - tags: - - testing - - ${DRONE_COMMIT_SHA} diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml new file mode 100644 index 0000000..c083679 --- /dev/null +++ b/.github/workflows/push.yaml @@ -0,0 +1,64 @@ +name: push + +on: push + +permissions: + contents: read + id-token: write + +jobs: + test: + runs-on: ubuntu-latest + env: + GO111MODULE: "on" + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v4 + with: + go-version: "1.18" + - run: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go test -v -cover $(go list ./...) + + build: + needs: test + runs-on: ubuntu-latest + env: + GO111MODULE: "on" + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v4 + with: + go-version: "1.18" + - run: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o bin/hermod-linux-amd64 . + - uses: actions/upload-artifact@v4 + with: + name: bin + path: bin/ + + docker: + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/download-artifact@v4 + with: + name: bin + path: bin/ + - name: Login to Quay.io + uses: docker/login-action@v3 + with: + registry: quay.io + username: ${{ secrets.QUAY_USERNAME }} + password: ${{ secrets.QUAY_PASSWORD }} + - id: meta + uses: docker/metadata-action@v5 + with: + images: quay.io/uswitch/hermod + tags: | + type=semver,pattern={{raw}} + type=sha,prefix=,format=long + - uses: docker/build-push-action@v6 + with: + context: . + labels: ${{ steps.meta.outputs.labels }} + push: true + tags: ${{ steps.meta.outputs.tags }} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 8535831..56633b4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,6 +6,6 @@ FROM scratch COPY --from=base /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ -ADD bin/hermod-linux-amd64 hermod +ADD --chmod=755 bin/hermod-linux-amd64 hermod ENTRYPOINT ["/hermod"]