-
Notifications
You must be signed in to change notification settings - Fork 94
68 lines (66 loc) · 2.48 KB
/
deploy.yaml
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
name: Build toolchain docker image
on:
push:
branches:
- '*'
pull_request:
branches:
- '*'
jobs:
Docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 1
persist-credentials: false
- name: Set up Docker Buildx
if: success()
id: buildx
uses: crazy-max/ghaction-docker-buildx@v3
with:
buildx-version: latest
qemu-version: latest
- name: Prepare
if: success()
id: prepare
run: |
echo ::set-output name=docker_platforms::linux/amd64,linux/386
echo ::set-output name=docker_username::miigotu
echo ::set-output name=github_image::docker.pkg.github.com/${GITHUB_REPOSITORY,,}/ps3dev
VERSION_TAG=${GITHUB_REF#refs/*/}
echo ::set-output name=version::${VERSION_TAG%/merge}
- name: Available platforms
if: success()
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Docker Login and set build command
if: success()
id: login
env:
GITHUB_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "${GITHUB_PASSWORD}" | docker login --username "${{ steps.prepare.outputs.docker_username }}" --password-stdin docker.pkg.github.com
echo ::set-output name=buildx::$(echo docker buildx build --output type=image,name=${{ steps.prepare.outputs.github_image }},push=true \
--platform ${{ steps.prepare.outputs.docker_platforms }} --cache-from "type=local,src=/tmp/.buildx-cache" --cache-to "type=local,dest=/tmp/.buildx-cache" \
--tag "${{ steps.prepare.outputs.github_image }}:${{ steps.prepare.outputs.version }}")
- name: Cache Docker layers
uses: actions/cache@v2
id: cache
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ steps.prepare.outputs.version }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Run Buildx (master)
if: success() && steps.prepare.outputs.version == 'master' && github.event_name != 'pull_request'
run: |
${{ steps.login.outputs.buildx }} --tag "${{ steps.prepare.outputs.github_image }}:latest" --file Dockerfile .
- name: Run Buildx (non-master)
if: success() && steps.prepare.outputs.version != 'master' && github.event_name != 'pull_request'
run: |
${{ steps.login.outputs.buildx }} --file Dockerfile .
- name: Clear
if: always()
run: |
rm -rf ${HOME}/.docker/config.json