Add support for turning off clicks/opens independently of one another #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: CI | |
on: [push] | |
jobs: | |
release-please: | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' | |
outputs: | |
release_created: ${{ steps.release-please.outputs.release_created }} | |
tag_name: ${{ steps.release-please.outputs.tag_name }} # e.g. v1.0.0 | |
version: ${{ steps.release-please.outputs.version }} # e.g. 1.0.0 | |
all: ${{ toJSON(steps.release-please.outputs) }} | |
steps: | |
- uses: google-github-actions/release-please-action@v3 | |
id: release-please | |
with: | |
command: manifest | |
build: | |
name: CI Image Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: docker/setup-buildx-action@v2 | |
- uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- uses: docker/build-push-action@v4 | |
with: | |
push: true | |
tags: ghcr.io/buttondown/postal:ci-${{ github.sha }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
target: ci | |
platforms: linux/amd64 | |
test: | |
name: Test Suite | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: docker/setup-qemu-action@v3 | |
- uses: docker/setup-buildx-action@v2 | |
- uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- run: docker compose pull | |
env: | |
POSTAL_IMAGE: ghcr.io/buttondown/postal:ci-${{ github.sha }} | |
- run: docker compose run postal sh -c 'bundle exec rspec' | |
env: | |
POSTAL_IMAGE: ghcr.io/buttondown/postal:ci-${{ github.sha }} | |
release-branch: | |
name: Release (branch) | |
runs-on: ubuntu-latest | |
needs: [build] | |
if: >- | |
startsWith(github.ref, 'refs/heads/') && | |
startsWith(github.ref, 'refs/heads/release-please-') != true && | |
startsWith(github.ref, 'refs/heads/dependabot/') != true | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: docker/setup-qemu-action@v3 | |
- uses: docker/setup-buildx-action@v2 | |
- uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- id: info | |
run: | | |
IMAGE=ghcr.io/buttondown/postal | |
REF="${GITHUB_REF#refs/heads/}" | |
if [ -z "$REF" ]; then exit 1; fi | |
VER="$(git describe --tags 2>/dev/null)" | |
echo "version=${VER}" >> "$GITHUB_OUTPUT" | |
echo "branch=${REF}" >> "$GITHUB_OUTPUT" | |
echo 'tags<<EOF' >> "$GITHUB_OUTPUT" | |
if [[ "$REF" == "main" ]]; then | |
echo "${IMAGE}:latest" >> "$GITHUB_OUTPUT" | |
else | |
echo "${IMAGE}:branch-${REF}" >> "$GITHUB_OUTPUT" | |
fi | |
echo 'EOF' >> "$GITHUB_OUTPUT" | |
- uses: docker/build-push-action@v4 | |
with: | |
push: true | |
tags: ${{ steps.info.outputs.tags }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
target: full | |
platforms: linux/amd64 | |
build-args: | | |
VERSION=${{ steps.info.outputs.version }} | |
BRANCH=${{ steps.info.outputs.branch }} | |
publish-image: | |
name: Publish Image | |
runs-on: ubuntu-latest | |
needs: [build, test, release-please] | |
if: ${{ needs.release-please.outputs.release_created }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: docker/setup-qemu-action@v3 | |
- uses: docker/setup-buildx-action@v2 | |
- uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- uses: docker/build-push-action@v4 | |
with: | |
push: true | |
tags: | | |
ghcr.io/buttondown/postal:stable | |
ghcr.io/buttondown/postal:${{ needs.release-please.outputs.version }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
target: full | |
build-args: | | |
VERSION=${{ needs.release-please.outputs.version }} | |
platforms: linux/amd64 |