CCash/.github/workflows/build.yaml
2021-06-24 19:16:00 +01:00

41 lines
1.3 KiB
YAML

name: Build
on:
push:
branches:
- main
jobs:
release:
name: Push Docker image to GitHub Packages
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Checkout the repo
uses: actions/checkout@v2
- name: Login to GitHub Docker Registry
uses: docker/login-action@v1
with:
registry: docker.pkg.github.com
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Format repository
run: |
echo IMAGE_REPOSITORY=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
- name: Build container image
uses: docker/build-push-action@v2
with:
push: true
tags: |
docker.pkg.github.com/${{ env.IMAGE_REPOSITORY }}/ccash:${{ github.sha }}
docker.pkg.github.com/${{ env.IMAGE_REPOSITORY }}/ccash:latest
trigger-deploy:
needs: release
runs-on: ubuntu-latest
steps:
- run: |
curl -X POST \
-H 'Accept: application/vnd.github.v3+json' \
-H 'Authorization: Bearer ${{ secrets.CCASH_DEPLOY_TOKEN }}' \
https://api.github.com/repos/${{ github.repository }}/actions/workflows/deploy.yaml/dispatches \
-d '{"ref":"main"}'