79 lines
2.5 KiB
YAML
79 lines
2.5 KiB
YAML
name: deploy
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "v*[0-9].*[0-9].*[0-9]?(-rc?(.*[0-9])|-dev?(.*[0-9]))"
|
|
- latest
|
|
|
|
env:
|
|
REPOSITORY: dataheath/reactive-resume
|
|
HOSTNAME: gitea.antoine-langlois.net
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: debian-docker
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v2
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v2
|
|
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@v2
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_TOKEN }}
|
|
|
|
- name: Login to Gitea Container Registry
|
|
uses: docker/login-action@v2
|
|
with:
|
|
registry: ${{ env.HOSTNAME }}
|
|
username: ${{ gitea.repository_owner }}
|
|
password: ${{ secrets.REGISTRY_TOKEN }}
|
|
|
|
- name: Fetch remote repository
|
|
id: fetch_version
|
|
run: |
|
|
if [[ ${{ gitea.ref_name }} == 'latest' ]]; then
|
|
export VERSION=$(curl -sfL https://api.github.com/repos/AmruthPillai/Reactive-Resume/releases/latest | jq .tag_name -r)
|
|
else
|
|
export VERSION=${{ gitea.ref_name }}
|
|
fi
|
|
|
|
git clone --depth 1 --branch $VERSION https://github.com/AmruthPillai/Reactive-Resume.git app
|
|
|
|
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
|
|
- name: Build and push latest
|
|
uses: docker/build-push-action@v4
|
|
if: ${{ gitea.ref_name == 'latest' }}
|
|
with:
|
|
context: .
|
|
push: true
|
|
cache-to: type=inline
|
|
cache-from: |
|
|
type=registry,ref=${{ env.REPOSITORY}}:latest
|
|
type=registry,ref=${{ env.HOSTNAME }}/${{ env.REPOSITORY }}:latest
|
|
tags: |
|
|
${{ env.REPOSITORY }}:${{ steps.get_version.outputs.version }}
|
|
${{ env.REPOSITORY }}:latest
|
|
${{ env.HOSTNAME }}/${{ env.REPOSITORY }}:${{ steps.get_version.outputs.version }}
|
|
${{ env.HOSTNAME }}/${{ env.REPOSITORY }}:latest
|
|
|
|
- name: Build and push tag
|
|
uses: docker/build-push-action@v4
|
|
if: ${{ gitea.ref_name != 'latest' }}
|
|
with:
|
|
context: .
|
|
platforms: linux/amd64
|
|
push: true
|
|
cache-from: type=registry,ref=${{ env.REPOSITORY }}:latest
|
|
tags: |
|
|
${{ env.REPOSITORY }}:${{ steps.get_version.outputs.version }
|
|
${{ env.HOSTNAME }}/${{ env.REPOSITORY }}:${{ steps.get_version.outputs.version }}
|