Skip to content

Commit

Permalink
Automate build and publish steps (#2)
Browse files Browse the repository at this point in the history
* Automate build and publish steps

Automate build and publish steps for image

* Update README.md
  • Loading branch information
BCook98 authored Aug 17, 2022
1 parent 9875484 commit b5c1fc4
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 13 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -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
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
1 change: 0 additions & 1 deletion WORAKTO_SDK_VERSION.txt

This file was deleted.

9 changes: 0 additions & 9 deletions build.sh

This file was deleted.

15 changes: 15 additions & 0 deletions publish.sh
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit b5c1fc4

Please sign in to comment.