mirror of
https://github.com/TECHNOFAB11/dbmate.git
synced 2025-12-12 08:00:04 +01:00
Publish Docker image (#220)
This commit is contained in:
parent
7c6f9ed747
commit
4a3698c7ac
4 changed files with 62 additions and 2 deletions
76
.github/workflows/ci.yml
vendored
Normal file
76
.github/workflows/ci.yml
vendored
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
tags: "v*"
|
||||
pull_request:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Environment
|
||||
run: |
|
||||
set -x
|
||||
docker version
|
||||
docker-compose version
|
||||
|
||||
- name: Cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
key: cache
|
||||
path: .cache
|
||||
|
||||
- name: Build docker image
|
||||
run: |
|
||||
set -x
|
||||
docker-compose build
|
||||
docker-compose run --rm --no-deps dbmate --version
|
||||
|
||||
- name: Build binaries
|
||||
run: |
|
||||
set -x
|
||||
docker-compose run --rm --no-deps dev make build-all
|
||||
dist/dbmate-linux-amd64 --version
|
||||
|
||||
- name: Lint
|
||||
run: docker-compose run --rm --no-deps dev make lint
|
||||
|
||||
- name: Start test dependencies
|
||||
run: |
|
||||
set -x
|
||||
docker-compose pull --quiet
|
||||
docker-compose up --detach
|
||||
|
||||
- name: Run tests
|
||||
run: |
|
||||
set -x
|
||||
docker-compose run --rm dev make wait
|
||||
docker-compose run --rm dev make test
|
||||
|
||||
- name: Publish docker image
|
||||
if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') }}
|
||||
env:
|
||||
SRC_IMAGE: dbmate_release
|
||||
DOCKERHUB_IMAGE: ${{ github.repository }}
|
||||
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
GHCR_IMAGE: ghcr.io/${{ github.repository }}
|
||||
GHCR_USERNAME: ${{ github.actor }}
|
||||
GHCR_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: .github/workflows/publish-docker.sh
|
||||
|
||||
- name: Publish release binaries
|
||||
uses: softprops/action-gh-release@v1
|
||||
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
|
||||
with:
|
||||
files: dist/*
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
Loading…
Add table
Add a link
Reference in a new issue