-
Notifications
You must be signed in to change notification settings - Fork 5
48 lines (40 loc) · 1.44 KB
/
build-image.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
name: Build Flarum Deploy Image
on:
push:
branches: [ main ]
env:
REGISTRY: ghcr.io
jobs:
build:
name: Build and Push Docker image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
submodules: true
- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Declare some variables
id: vars
shell: bash
run: |
echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
- name: Build and Push
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ghcr.io/0xffff-one/flarum-0x:latest,ghcr.io/0xffff-one/flarum-0x:${{ steps.vars.outputs.sha_short }}
- name: Trigger production build
shell: bash
run: |
curl -XPOST -u "${{ secrets.PROD_USERNAME }}:${{ secrets.PROD_TOKEN }}" -H "Accept: application/vnd.github.everest-preview+json" -H "Content-Type: application/json" https://api.github.com/repos/${{ secrets.PROD_REPO }}/dispatches --data '{"event_type": "build_production_image"}'