Skip to content

cd: add deploy workflow #5

cd: add deploy workflow

cd: add deploy workflow #5

Workflow file for this run

name: Release
on:
push:
tags:
- "v*"
jobs:
build-and-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Run tests with docker-compose
run: docker compose -f docker-compose-test.yml up --quiet-pull --abort-on-container-exit --exit-code-from test
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ secrets.DOCKER_USERNAME }}/sitme
tags: |
type=ref,event=tag
type=raw,value=latest
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
# - name: Create GitHub Release Draft
# uses: actions/create-release@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# tag_name: ${{ github.ref_name }}
# release_name: Release ${{ github.ref_name }}
# draft: true
# prerelease: false
# body: |
# ## Changes
# Docker image: `${{ secrets.DOCKER_USERNAME }}/ff5-dreamroute:${{ github.ref_name }}`
# ## Installation
# ```bash
# docker pull ${{ secrets.DOCKER_USERNAME }}/ff5-dreamroute:${{ github.ref_name }}
# ```
- name: Clean up
if: always()
run: docker compose -f docker-compose-test.yml down -v