2024-04-27 18:02:06 +00:00
|
|
|
name: Build and push Docker image
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build-and-publish:
|
|
|
|
runs-on: docker
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
2024-04-27 18:32:41 +00:00
|
|
|
|
2024-04-27 18:02:06 +00:00
|
|
|
- name: Build latest
|
|
|
|
uses: https://codeberg.org/umglurf/kaniko-action@main
|
|
|
|
with:
|
|
|
|
cache: true
|
2024-04-27 18:03:55 +00:00
|
|
|
cache_repo: ${{ vars.REGISTRY_URL }}/${{ github.repository }}/cache
|
2024-04-27 18:02:06 +00:00
|
|
|
credentials: |
|
2024-04-27 18:03:55 +00:00
|
|
|
${{ vars.REGISTRY_URL }}=${{ secrets.REGISTRY_USERNAME }}:${{ secrets.REGISTRY_TOKEN }}
|
2024-04-27 18:02:06 +00:00
|
|
|
destinations: |
|
2024-04-27 18:03:55 +00:00
|
|
|
${{ vars.REGISTRY_URL }}/${{ github.repository }}:latest ${{ vars.REGISTRY_URL }}/${{ github.repository }}:${{ github.sha }}
|
2024-04-27 18:02:06 +00:00
|
|
|
push: "true"
|
|
|
|
if: github.ref == 'refs/heads/master'
|
2024-04-27 18:32:41 +00:00
|
|
|
|
2024-04-27 18:02:06 +00:00
|
|
|
- name: Build ref
|
|
|
|
uses: https://codeberg.org/umglurf/kaniko-action@main
|
|
|
|
with:
|
|
|
|
cache: true
|
2024-04-27 18:03:55 +00:00
|
|
|
cache_repo: ${{ vars.REGISTRY_URL }}/${{ github.repository }}/cache
|
2024-04-27 18:02:06 +00:00
|
|
|
credentials: |
|
2024-04-27 18:03:55 +00:00
|
|
|
${{ vars.REGISTRY_URL }}=${{ secrets.REGISTRY_USERNAME }}:${{ secrets.REGISTRY_TOKEN }}
|
2024-04-27 18:02:06 +00:00
|
|
|
destinations: |
|
2024-04-27 18:03:55 +00:00
|
|
|
${{ vars.REGISTRY_URL }}/${{ github.repository }}:${{ github.ref_name }} ${{ vars.REGISTRY_URL }}/${{ github.repository }}:${{ github.sha }}
|
2024-04-27 18:02:06 +00:00
|
|
|
push: "true"
|
|
|
|
if: github.ref != 'refs/heads/master'
|
2024-04-27 18:32:41 +00:00
|
|
|
|
|
|
|
- name: Deploy via shipit
|
|
|
|
uses: https://github.com/Hamcha/shipit@main
|
|
|
|
with:
|
|
|
|
provider: ${{ secrets.SHIPIT_PROVIDER }}
|
|
|
|
changes: '[{"templater":"yaml","file":"docker-compose.yml","changes":{"services.srht-mirror.image":"git.fromouter.space/hamcha/sourcehut-mirror-bridge:${{ github.sha }}"}}]'
|
|
|
|
branch: master
|