-
Notifications
You must be signed in to change notification settings - Fork 2
107 lines (100 loc) · 3.69 KB
/
package.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
104
105
106
107
name: Package
# Run workflow on tags starting with v (eg. v2, v1.2.0)
on:
push:
tags:
- v*
jobs:
Package-Docker:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
# list of Docker images to use as base name for tags
images: |
ghcr.io/${{ github.repository }}
# generate Docker tags based on the following events/attributes
tags: |
type=semver,pattern={{raw}}
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
type=ref,event=branch
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Build and Push Docker Image
uses: docker/build-push-action@v2
with:
file: ./cmd/ical-relay/Dockerfile
platforms: linux/amd64,linux/arm64,linux/arm
push: true # Will only build if this is not here
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Compile:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-go@v4
with:
go-version: '1.18.0' # The Go version to download (if necessary) and use.
- run: go generate cmd/ical-relay/main.go
- run: go build -o ./bin/ical-relay ./cmd/ical-relay/ && strip ./bin/ical-relay
- uses: actions/upload-artifact@v3
with:
name: ical-relay
path: ./bin/ical-relay
Package-deb:
needs: Compile
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Create debpkg structure
run: |
mkdir -p cmd/ical-relay/.debpkg/etc/ical-relay
mkdir -p cmd/ical-relay/.debpkg/opt/ical-relay
cp cmd/ical-relay/config.yml.example cmd/ical-relay/.debpkg/etc/ical-relay/
cp -r cmd/ical-relay/templates cmd/ical-relay/.debpkg/opt/ical-relay/templates/
mkdir -p cmd/ical-relay/.debpkg/etc/systemd/system/
cp cmd/ical-relay/misc/ical-relay.service cmd/ical-relay/.debpkg/etc/systemd/system/
mkdir -p cmd/ical-relay/.debpkg/DEBIAN
cp cmd/ical-relay/misc/postinstall.sh cmd/ical-relay/.debpkg/DEBIAN/postinst
chmod +x cmd/ical-relay/.debpkg/DEBIAN/postinst
- name: Download binary
uses: actions/download-artifact@v3
id: download
with:
name: ical-relay
- run: |
mkdir -p cmd/ical-relay/.debpkg/usr/bin
cp ${{steps.download.outputs.download-path}}/ical-relay cmd/ical-relay/.debpkg/usr/bin/
chmod +x cmd/ical-relay/.debpkg/usr/bin/ical-relay
- uses: jiro4989/build-deb-action@v2
id: package
with:
package: ical-relay
package_root: ./cmd/ical-relay/.debpkg
maintainer: Julian Lemmerich <mail@julian-lemmerich.de>
version: ${{ github.ref }} # refs/tags/v*.*.*
arch: 'amd64'
desc: 'Relay ical urls and edit them on the fly with different modules.'
- uses: actions/upload-artifact@v3
with:
name: ical-relay.deb
path: ${{steps.package.outputs.file_name}}