-
Notifications
You must be signed in to change notification settings - Fork 12
87 lines (80 loc) · 2.57 KB
/
docker-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
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
name: Create and publish a Docker image
on:
push:
branches:
- "main"
paths-ignore:
- "**.md"
- "docker-compose.yml"
- "docker-compose.dev.yml"
- ".github/ISSUE_TEMPLATE/*.yml"
- ".github/dependabot.yml"
pull_request:
branches:
- "main"
paths-ignore:
- "**.md"
- "docker-compose.yml"
- "docker-compose.dev.yml"
- ".github/ISSUE_TEMPLATE/*.yml"
- ".github/dependabot.yml"
workflow_dispatch:
release:
types: [published, edited]
jobs:
build-and-publish-image:
runs-on: ubuntu-latest
environment: 05a580ce02c1b4b40b081cc9f6e028
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/${{ github.repository }}
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}
type=semver,pattern={{major}}.{{minor}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Publish Docker Image
uses: docker/build-push-action@v4
id: build-push
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Set container SHA
id: set-container-sha
run: |
echo "::set-output name=CONTAINER_SHA::${{ steps.build-push.outputs.digest }}"
echo $CONTAINER_SHA
- uses: paperspace/[email protected]
name: Deploy to Paperspace
id: deploy
env:
PAPERSPACE_API_KEY: 05a580ce02c1b4b40b081cc9f6e028
CONTAINER_SHA: ${{ steps.set-container-sha.outputs.CONTAINER_SHA }}
with:
projectId: pioiimjvdsx
configPath: /../.paperspace/app.yaml
image: ghcr.io/${{ github.repository }}:latest@${{ steps.build-push.outputs.digest }}