forked from sdorra/devboxes
-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (72 loc) · 2.59 KB
/
Build.yaml
File metadata and controls
86 lines (72 loc) · 2.59 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
name: Build
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
exec:
runs-on: ubuntu-20.04
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v2.3.4
# Provide required binaries
# fc-cache (fontconfig)
# gsettings (gnome)
- name: install
run: sudo apt-get update && sudo apt-get install -y ansible unzip fontconfig gnome-core snapd snap-confine
# Uninstall gh in order to avoid error: "A later version is already installed"
- name: Uninstall preconfigured github cli
run: sudo apt-get remove gh
- name: create vars.yaml
run: |
cat << EOF > vars.yml
mail: some@o.ne
displayName: Some one
gpgKey: "abcdef"
dotfilesRepo: https://github.com/schnatterer/dotfiles/
EOF
- name: Initial smoke test
env:
# Avoid hitting rate limit for bin
# https://github.com/marcosnils/bin/tree/74bf#i-used-bin-and-i-got-rate-limited-by-github-what-can-i-do
GITHUB_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./devbox -e ansible_become_pass=''
# Make sure the playbook also succeeds on incremental run
- name: Incremental smoke test
env:
GITHUB_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./devbox -e ansible_become_pass=''
- name: Log in to the Container registry
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# defaults: schedule and ref types
# Additional: Set sha tag for each image
# And: Main branch is latest for now
tags: |
type=schedule
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
type=sha,prefix=,format=short
type=raw,enable=${{ github.ref == 'refs/heads/main' }},value=latest
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}