From 46eee96a64947dd75684b99c5f1dbe3d37afc535 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Batuhan=20Apayd=C4=B1n?= Date: Tue, 17 Nov 2020 16:12:55 +0300 Subject: [PATCH] github actions integration completed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Batuhan Apaydın --- .github/workflows/build.yaml | 45 +++++++++++++++++++++++++++++++++ .github/workflows/publish.yaml | 46 ++++++++++++++++++++++++++++++++++ .travis.yml | 20 --------------- 3 files changed, 91 insertions(+), 20 deletions(-) create mode 100644 .github/workflows/build.yaml create mode 100644 .github/workflows/publish.yaml delete mode 100644 .travis.yml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..11fd0dd --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,45 @@ +name: build + +on: + push: + branches: [ '*' ] + pull_request: + branches: [ '*' ] + +jobs: + build: + strategy: + matrix: + go-version: [1.13.x] + os: [ubuntu-latest] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@master + - name: Install Go + uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.go-version }} + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Build x86_64 container into library + uses: docker/build-push-action@v2 + with: + context: . + file: ./Dockerfile + outputs: "type=docker,push=false" + platforms: linux/amd64 + tags: | + ghcr.io/openfaas/cron-connector:${{ github.sha }} + + - name: Build multi-arch containers for validation only + uses: docker/build-push-action@v2 + with: + context: . + file: ./Dockerfile + outputs: "type=image,push=false" + platforms: linux/amd64,linux/arm/v7,linux/arm64 + tags: | + ghcr.io/openfaas/cron-connector:${{ github.sha }} \ No newline at end of file diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 0000000..f9f449b --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,46 @@ +name: publish + +on: + push: + tags: + - '*' + +jobs: + publish: + strategy: + matrix: + go-version: [1.13.x] + os: [ubuntu-latest] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@master + - name: Install Go + uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.go-version }} + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - name: Get TAG + id: get_tag + run: echo ::set-output name=TAG::${GITHUB_REF#refs/tags/} + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - name: Login to Docker Registry + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + registry: ghcr.io + - name: Push containers + uses: docker/build-push-action@v2 + with: + context: . + file: ./Dockerfile + outputs: "type=registry,push=true" + platforms: linux/amd64,linux/arm/v7,linux/arm64 + tags: | + ghcr.io/openfaas/cron-connector:${{ github.sha }} + ghcr.io/openfaas/cron-connector:${{ steps.get_tag.outputs.TAG }} + ghcr.io/openfaas/cron-connector:latest \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index c7b6f41..0000000 --- a/.travis.yml +++ /dev/null @@ -1,20 +0,0 @@ -sudo: required -language: go - -go: -- "1.11" - -services: -- docker - -script: -- TAG=${TRAVIS_TAG:=latest} make build - -before_deploy: -- echo "${DOCKER_PASSWORD}" | docker login -u "${DOCKER_USERNAME}" --password-stdin - -deploy: - provider: script - script: TAG=${TRAVIS_TAG} make push manifest - on: - tags: true