Skip to content

Commit 90ab972

Browse files
committed
feat: deploy action
1 parent 5c6e1fb commit 90ab972

1 file changed

Lines changed: 66 additions & 0 deletions

File tree

.github/workflows/deploy-build.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: 🐳 Build and Push
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request: {}
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
permissions:
14+
contents: read
15+
packages: write
16+
17+
jobs:
18+
build:
19+
name: 🐳 Build
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: ⬇️ Checkout repo
23+
uses: actions/checkout@v4
24+
25+
- name: 🐳 Set up Docker Buildx
26+
uses: docker/setup-buildx-action@v3
27+
28+
- name: ⚡️ Cache Docker layers
29+
uses: actions/cache@v4
30+
with:
31+
path: /tmp/.buildx-cache
32+
key: ${{ runner.os }}-buildx-${{ github.sha }}
33+
restore-keys: |
34+
${{ runner.os }}-buildx-
35+
36+
- name: 📋 Docker meta
37+
id: meta
38+
uses: docker/metadata-action@v5
39+
with:
40+
images: ghcr.io/opensensemap/ttn-integration
41+
tags: |
42+
type=raw,value=latest,enable={{is_default_branch}}
43+
type=sha,prefix=main-
44+
45+
- name: 🔑 GitHub Registry Auth
46+
if: github.event_name != 'pull_request'
47+
uses: docker/login-action@v3
48+
with:
49+
registry: ghcr.io
50+
username: ${{ github.actor }}
51+
password: ${{ secrets.GITHUB_TOKEN }}
52+
53+
- name: 🐳 Docker build
54+
uses: docker/build-push-action@v5
55+
with:
56+
context: .
57+
push: ${{ github.event_name != 'pull_request' }}
58+
tags: ${{ steps.meta.outputs.tags }}
59+
labels: ${{ steps.meta.outputs.labels }}
60+
cache-from: type=local,src=/tmp/.buildx-cache
61+
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new
62+
63+
- name: 🚚 Move cache
64+
run: |
65+
rm -rf /tmp/.buildx-cache
66+
mv /tmp/.buildx-cache-new /tmp/.buildx-cache

0 commit comments

Comments
 (0)