diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..011f505 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,40 @@ +# yamllint disable rule:line-length +--- +name: Build + +# yamllint disable-line rule:truthy +on: + workflow_dispatch: + +jobs: + protoc: + runs-on: ubuntu-latest + permissions: + packages: write + contents: write + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Set up QEMU + id: qemu + uses: docker/setup-qemu-action@v1 + with: + image: tonistiigi/binfmt:latest + platforms: linux/amd64,linux/arm64 + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v1 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and Publish + run: ./publish.sh diff --git a/README.md b/README.md index e120daf..57fb0ca 100644 --- a/README.md +++ b/README.md @@ -10,11 +10,10 @@ docker run \ --env WORKATO_API_TOKEN="my-token" \ -v $(pwd):/usr/src/connector \ --workdir /usr/src/connector \ - ghcr.io/safetyculture/workato-connector-sdk:0.3.0 + ghcr.io/safetyculture/workato-connector-sdk:latest help ``` ## Updating -1. Update the version in `WORAKTO_SDK_VERSION.txt`. -2. Run `./build.sh && docker push ghcr.io/safetyculture/workato-connector-sdk:$(cat WORAKTO_SDK_VERSION.txt)` +Manually trigger the GitHub action to recreate the image with the latest version of the gem. diff --git a/WORAKTO_SDK_VERSION.txt b/WORAKTO_SDK_VERSION.txt deleted file mode 100644 index 0d91a54..0000000 --- a/WORAKTO_SDK_VERSION.txt +++ /dev/null @@ -1 +0,0 @@ -0.3.0 diff --git a/build.sh b/build.sh deleted file mode 100755 index e454339..0000000 --- a/build.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -set -e - -WORKATO_SDK_VERSION=$(cat WORAKTO_SDK_VERSION.txt) - -docker build \ - --build-arg WORKATO_SDK_VERSION="$WORKATO_SDK_VERSION" \ - . -t "ghcr.io/safetyculture/workato-connector-sdk:$WORKATO_SDK_VERSION" diff --git a/publish.sh b/publish.sh new file mode 100755 index 0000000..cb0b92b --- /dev/null +++ b/publish.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +set -e + +REPOSITORY="ghcr.io/safetyculture" +PLATFORM="linux/amd64,linux/arm64" + +WORKATO_SDK_VERSION=$(curl https://api.github.com/repos/workato/workato-connector-sdk/releases/latest | jq -r '.tag_name' | sed -r 's/v//g') + +docker buildx build \ + --platform "$PLATFORM" \ + --build-arg WORKATO_SDK_VERSION="$WORKATO_SDK_VERSION" \ + . \ + -t "$REPOSITORY/workato-connector-sdk:$WORKATO_SDK_VERSION" \ + -t "$REPOSITORY/workato-connector-sdk:latest"