-
Notifications
You must be signed in to change notification settings - Fork 1
90 lines (77 loc) · 2.69 KB
/
main.yml
File metadata and controls
90 lines (77 loc) · 2.69 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# If you edit this file, make sure to make a matching edit in autobuild.yml
# Based on https://docs.github.com/en/actions/guides/publishing-docker-images
name: Generate pre-release Docker images
on:
push:
branches:
- main
workflow_dispatch:
jobs:
push_to_registries:
name: Push pre-release image to GitHub Packages
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Check out the repo
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Update Dockerfile
run: |
./bin/run.sh build || exit 2
git add -f */Dockerfile || exit 2
git diff --quiet || git commit */Dockerfile -m 'Update Dockerfile'
env:
GIT_AUTHOR_NAME: "Automatic updater [bot]"
GIT_AUTHOR_EMAIL: "sleepdiary-bot@pileofstuff.org"
GIT_COMMITTER_NAME: "Automatic updater [bot]"
GIT_COMMITTER_EMAIL: "sleepdiary-bot@pileofstuff.org"
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for "builder"
id: builder_meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/${{ github.repository_owner }}/builder
- name: Extract metadata (tags, labels) for "dev-server"
id: dev-server_meta
uses: docker/metadata-action@v4
with:
images: |
${{ secrets.DOCKERHUB_USERNAME }}/dev-server
ghcr.io/${{ github.repository_owner }}/dev-server
- name: Build and push image for "builder"
uses: docker/build-push-action@v3
with:
context: builder
push: true
tags: ghcr.io/${{ github.repository_owner }}/builder:pre-release
labels: ${{ steps.builder_meta.outputs.labels }}
- name: Build and push image for "dev-server"
uses: docker/build-push-action@v3
with:
context: dev-server
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/dev-server:pre-release
labels: ${{ steps.dev-server_meta.outputs.labels }}
check:
name: Check pre-release image works correctly
runs-on: ubuntu-latest
needs: push_to_registries
steps:
- name: Check
uses: docker://docker.io/sleepdiaryproject/dev-server:pre-release
with:
args: check