From ea05df725a4c84b7af9f8b76784f2e3daefc715f Mon Sep 17 00:00:00 2001 From: dhh Date: Mon, 23 Oct 2023 09:28:12 -0700 Subject: [PATCH] Github workflows --- .github/workflows/ci.yml | 31 ++++++++++++++++ .github/workflows/docker-publish.yml | 55 ++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/docker-publish.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..fce833e --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,31 @@ +name: CI +on: + push: + branches: + - main + pull_request: +jobs: + tests: + strategy: + matrix: + ruby-version: + - "3.2" + gemfile: + - Gemfile + continue-on-error: [false] + name: ${{ format('Tests (Ruby {0})', matrix.ruby-version) }} + runs-on: ubuntu-latest + continue-on-error: ${{ matrix.continue-on-error }} + env: + BUNDLE_GEMFILE: ${{ github.workspace }}/${{ matrix.gemfile }} + steps: + - uses: actions/checkout@v2 + + - name: Install Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby-version }} + bundler-cache: true + + - name: Run tests + run: bin/test diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml new file mode 100644 index 0000000..b568f68 --- /dev/null +++ b/.github/workflows/docker-publish.yml @@ -0,0 +1,55 @@ +name: Docker + +on: + workflow_dispatch: + inputs: + tagInput: + description: 'Tag' + required: true + + release: + types: [created] + tags: + - 'v*' + +jobs: + build-and-push-image: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - + name: Checkout + uses: actions/checkout@v3 + - + name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - + name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Determine version tag + id: version-tag + run: | + INPUT_VALUE="${{ github.event.inputs.tagInput }}" + if [ -z "$INPUT_VALUE" ]; then + INPUT_VALUE="${{ github.ref_name }}" + fi + echo "::set-output name=value::$INPUT_VALUE" + - + name: Build and push + uses: docker/build-push-action@v3 + with: + context: . + platforms: linux/amd64,linux/arm64 + push: true + tags: | + ghcr.io/basecamp/kamal:latest + ghcr.io/basecamp/kamal:${{ steps.version-tag.outputs.value }}