2023-12-11 07:33:30 -08:00
|
|
|
name: API Image
|
2022-01-03 04:08:34 -08:00
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2023-12-02 10:22:40 -08:00
|
|
|
paths:
|
|
|
|
- 'api/**'
|
2023-12-02 10:29:53 -08:00
|
|
|
- '.github/workflows/api-image.yml'
|
2022-01-03 04:08:34 -08:00
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
release:
|
|
|
|
types:
|
|
|
|
- published
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
2023-12-02 10:22:40 -08:00
|
|
|
name: push API docker image
|
2022-01-03 04:08:34 -08:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
2023-12-02 10:22:40 -08:00
|
|
|
- name: Check out Git repository
|
|
|
|
uses: actions/checkout@v4
|
2022-01-03 05:36:47 -08:00
|
|
|
with:
|
2023-12-02 10:22:40 -08:00
|
|
|
sparse-checkout: 'api'
|
|
|
|
sparse-checkout-cone-mode: false
|
|
|
|
- name: Move API files to root
|
|
|
|
run: |
|
|
|
|
ls -lah
|
|
|
|
shopt -s dotglob
|
|
|
|
mv api/* .
|
|
|
|
rm -rf api
|
|
|
|
ls -lah
|
2022-01-03 04:08:34 -08:00
|
|
|
|
2023-12-02 10:34:48 -08:00
|
|
|
- name: Log in to Docker Hub
|
|
|
|
uses: docker/login-action@v3
|
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
|
2022-01-03 04:08:34 -08:00
|
|
|
- name: Extract metadata (tags, labels) for Docker
|
|
|
|
id: meta
|
2023-12-02 10:22:40 -08:00
|
|
|
uses: docker/metadata-action@v5
|
2022-01-03 04:08:34 -08:00
|
|
|
with:
|
2023-12-02 10:22:40 -08:00
|
|
|
images: ohmyform/api
|
2022-01-03 04:08:34 -08:00
|
|
|
tags: |
|
|
|
|
type=raw,value=latest
|
|
|
|
type=semver,pattern={{major}}
|
|
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
|
|
type=semver,pattern={{version}}
|
|
|
|
|
|
|
|
- name: Build and push Docker image
|
2023-12-02 10:34:48 -08:00
|
|
|
uses: docker/build-push-action@v5
|
2022-01-03 04:08:34 -08:00
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
push: true
|
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|