This repository has been archived by the owner on Apr 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
99 lines (86 loc) · 3.19 KB
/
build.yaml
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
name: Publish Docker Image and Native Binaries
on:
push:
branches: '*'
paths:
- .github/workflows/build.yaml
- discord-irc.ts
- lib/**
- deno.*
- Dockerfile
tags: '*.*.*'
jobs:
publish-docker:
name: Publish Docker Image to GitHub Container Registry
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker 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: ${{ github.token }}
- name: Extract metadata for container image
uses: docker/metadata-action@v5
id: metadata
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Build and publish container image
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
publish-binaries:
name: Publish Native Binaries
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
- windows-latest
- macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Deno
uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- name: Set the OS name suffix
id: os-suffix
uses: actions/github-script@v7
with:
result-encoding: string
script: return "${{ runner.os }}".toLowerCase();
- name: Compile AMD64 binary for Windows
if: runner.os == 'Windows'
run: deno compile --allow-net --allow-env=CONFIG_FILE,DEBUG,VERBOSE,NODE_EXTRA_CA_CERTS --allow-read --allow-write --output discord-irc-${{ steps.os-suffix.outputs.result }}-amd64.exe discord-irc.ts
- name: Compile AMD64 and ARM64 binaries for ${{ runner.os }}
if: runner.os != 'Windows'
run: |
deno compile --allow-net --allow-env=CONFIG_FILE,DEBUG,VERBOSE,NODE_EXTRA_CA_CERTS --allow-read --allow-write --output discord-irc-${{ steps.os-suffix.outputs.result }}-amd64 discord-irc.ts
deno compile --allow-net --allow-env=CONFIG_FILE,DEBUG,VERBOSE,NODE_EXTRA_CA_CERTS --allow-read --allow-write --output discord-irc-${{ steps.os-suffix.outputs.result }}-arm64 --target ${{ steps.os-suffix.outputs.result == 'macos' && 'aarch64-apple-darwin' || 'aarch64-unknown-linux-gnu' }} discord-irc.ts
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ runner.os }}-${{ runner.os == 'Windows' && 'x64' || 'x64-ARM64' }}
path: ./discord-irc-*