Rolling Release #52
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: Rolling Release | |
on: workflow_dispatch | |
env: | |
# The default repo env will be 'ComputeStacks'; uppercase is not allowed. | |
GH_REPO: computestacks/controller | |
IMAGE_TAG: 9 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
services: | |
postgres: | |
image: postgres:15-alpine | |
env: | |
POSTGRES_USER: cstacks | |
POSTGRES_DB: cstacks | |
POSTGRES_PASSWORD: cstacks | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
redis: | |
# Docker Hub image | |
image: redis:7 | |
# Set health checks to wait until redis has started | |
options: >- | |
--health-cmd "redis-cli ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 6379:6379 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Setup Docker buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
buildkitd-flags: '--allow-insecure-entitlement network.host' | |
driver-opts: network=host | |
- name: Log into Github Registry | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Log into DockerHub | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Set Version | |
run: echo "${{ env.IMAGE_TAG }}" > VERSION | |
- name: Build and push | |
id: build-and-push | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
push: true | |
allow: network.host | |
network: host | |
tags: | | |
cmptstks/controller:${{ env.IMAGE_TAG }} | |
cmptstks/controller:latest | |
ghcr.io/${{ env.GH_REPO }}:${{ env.IMAGE_TAG }} | |
ghcr.io/${{ env.GH_REPO }}:latest | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
build-args: | | |
github_user=${{ github.actor }} | |
github_token=${{ secrets.GITHUB_TOKEN }} |