Skip to content

Commit f4db342

Browse files
authored
Add heartbeat
1 parent dda4752 commit f4db342

1 file changed

Lines changed: 72 additions & 0 deletions

File tree

‎.github/workflows/heartbeat.yaml‎

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: heartbeat
2+
3+
on:
4+
schedule:
5+
- cron: "0 10 * * *"
6+
push:
7+
branches:
8+
- "**"
9+
tags:
10+
- "v*.*.*"
11+
pull_request:
12+
branches:
13+
- "main"
14+
15+
jobs:
16+
tilemaker:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Set variables useful for later
20+
id: useful_vars
21+
run: |-
22+
echo "::set-output name=timestamp::$(date +%s)"
23+
echo "::set-output name=short_sha::${GITHUB_SHA::8}"
24+
- name: Checkout
25+
uses: actions/checkout@v3
26+
with:
27+
repository: 5HT2B/heartbeat
28+
submodules: recursive
29+
- name: Docker meta
30+
id: docker_meta
31+
uses: docker/metadata-action@v4
32+
with:
33+
images: ghcr.io/${{ github.repository }}/tilemaker
34+
tags: |
35+
type=schedule
36+
type=ref,event=branch
37+
type=ref,event=pr
38+
type=semver,pattern={{version}}
39+
type=semver,pattern={{major}}.{{minor}}
40+
type=semver,pattern={{major}}
41+
type=sha,prefix=,format=long,event=tag
42+
type=sha
43+
type=raw,value=latest,enable=${{ endsWith(github.ref, github.event.repository.default_branch) }}
44+
type=raw,value=${{ github.ref_name }}-${{ steps.useful_vars.outputs.short_sha }}-${{ steps.useful_vars.outputs.timestamp }},enable=${{ endsWith(github.ref, github.event.repository.default_branch) }}
45+
- name: Set up QEMU
46+
uses: docker/setup-qemu-action@v2
47+
- name: Set up Docker Buildx
48+
uses: docker/setup-buildx-action@v2
49+
- name: Login to GHCR
50+
if: github.event_name != 'pull_request'
51+
uses: docker/login-action@v2
52+
with:
53+
registry: ghcr.io
54+
username: ${{ github.repository_owner }}
55+
password: ${{ secrets.GITHUB_TOKEN }}
56+
- name: Cache Docker layers
57+
uses: actions/cache@v3
58+
with:
59+
path: /tmp/.buildx-cache
60+
key: ${{ runner.os }}-tilemaker-buildx-${{ github.sha }}
61+
restore-keys: |
62+
${{ runner.os }}-tilemaker-buildx-
63+
- name: Build and push
64+
uses: docker/build-push-action@v4
65+
with:
66+
context: .
67+
push: ${{ github.event_name != 'pull_request' }}
68+
tags: ${{ steps.docker_meta.outputs.tags }}
69+
labels: ${{ steps.docker_meta.outputs.labels }}
70+
platforms: linux/amd64,linux/arm64
71+
cache-from: type=local,src=/tmp/.buildx-cache
72+
cache-to: type=local,dest=/tmp/.buildx-cache,mode=max

0 commit comments

Comments
 (0)