-
Notifications
You must be signed in to change notification settings - Fork 239
103 lines (89 loc) · 3.83 KB
/
publish.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
on:
push:
branches:
- main
paths:
- 'base/publish/*'
pull_request:
branches:
- main
paths:
- 'base/publish/*'
schedule:
- cron: '0 0 * * 2'
workflow_dispatch:
name: Publish Debian & Ubuntu Base Images
jobs:
debian:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
packages: write
id-token: write
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +%s)"
- name: Build and push [Debian]
uses: docker/build-push-action@v5
with:
context: base/debian
platforms: linux/arm64, linux/amd64, linux/386
push: ${{ github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
tags: ghcr.io/railwayapp/nixpacks:debian, ghcr.io/railwayapp/nixpacks:debian-${{ steps.date.outputs.date }}
- name: Build and push [Ubuntu]
uses: docker/build-push-action@v5
with:
context: base/ubuntu
platforms: linux/arm64, linux/amd64
push: ${{ github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
tags: ghcr.io/railwayapp/nixpacks:ubuntu, ghcr.io/railwayapp/nixpacks:latest, ghcr.io/railwayapp/nixpacks:ubuntu-${{ steps.date.outputs.date }}
- name: Bump base image
if: ${{ github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
run: |
sed -i 's/nixpacks:debian-.*/nixpacks:debian-${{ steps.date.outputs.date }}";/g' src/nixpacks/images.rs
sed -i 's/nixpacks:ubuntu-.*/nixpacks:ubuntu-${{ steps.date.outputs.date }}";/g' src/nixpacks/images.rs
- name: Create Pull Request
if: ${{ github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
uses: peter-evans/create-pull-request@v7
with:
base: main
token: ${{ secrets.COMMITTER_TOKEN }}
commit-message: Bump base image
branch: publish-${{ steps.date.outputs.date }}
delete-branch: true
title: Bump base images to `${{ steps.date.outputs.date }}`
labels: release/patch
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push to Docker Hub [Debian]
uses: docker/build-push-action@v5
with:
context: base/debian
platforms: linux/arm64, linux/amd64, linux/386
push: ${{ github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
tags: railwayapp/nixpacks:debian, railwayapp/nixpacks:latest, railwayapp/nixpacks:debian-${{ steps.date.outputs.date }}
- name: Build and push to Docker Hub [Ubuntu]
uses: docker/build-push-action@v5
with:
context: base/ubuntu
platforms: linux/arm64, linux/amd64
push: ${{ github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
tags: railwayapp/nixpacks:ubuntu, railwayapp/nixpacks:ubuntu-${{ steps.date.outputs.date }}