Skip to content

chores: docker and binary workflow #14

chores: docker and binary workflow

chores: docker and binary workflow #14

Workflow file for this run

name: Build and upload Docker image
on:
release:
types: [published]
push:
branches: [dev]
tags:
- "*.*.*"
env:
REGISTRY: ghcr.io
BASE_NAME: graphops/graphcast-3la
jobs:
build-linux:
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: password
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
env:
DATABASE_URL: postgresql://postgres:password@localhost:5432/3la-test
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Database
run: |
cargo install sqlx-cli --features postgres
sqlx db setup
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
# list of Docker images to use as base name for tags
images: |
${{ env.REGISTRY }}/${{ env.BASE_NAME }}
# generate Docker tags based on the following events/attributes
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}.{{minor}}.{{patch}}
type=semver,pattern={{major}}
type=sha
latest:main
latest:dev
- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.DOCKER_TOKEN }}
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Migrate database
env:
DATABASE_URL: postgres://postgres:password@localhost:5432/3la-test
run: |
cargo install sqlx-cli --no-default-features --features postgres
sqlx database create
- uses: actions-rs/cargo@v1
with:
command: test
- name: Build and push
uses: docker/build-push-action@v4
with:
context: ./
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
dockerfile: Dockerfile