-
-
Notifications
You must be signed in to change notification settings - Fork 3
98 lines (86 loc) · 2.99 KB
/
release.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
name: Release
on:
schedule:
- cron: "0 0 * * *" # Every day at midnight
workflow_dispatch:
inputs:
bun-versions:
description: "Bun version, comma separated (e.g. 0.0.1,0.0.2,1.0.8-canary.20231104.1)"
required: false
default: ""
nodejs-version:
description: "Node.js version, comma separated (e.g. 14.7.4,17.3.8,18.4.5)"
required: false
default: ""
distros:
description: "Distro, comma separated (e.g. alpine,debian-slim,debian)"
required: false
default: ""
# TODO: To be implemented
# skip-check:
# description: "Skip version check"
# required: false
# default: "true"
env:
REGISTRY: imbios
PLATFORMS: linux/amd64,linux/arm64
NODE_MAJOR_VERSIONS_TO_CHECK: 18,20,22
NODE_VERSIONS_TO_BUILD: ""
BUN_TAGS_TO_CHECK: canary,latest
BUN_VERSIONS_TO_BUILD: ""
DISTROS: alpine,debian-slim,debian
jobs:
check-and-build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install jq
run: sudo apt install jq
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Check for new releases of nodejs and bun
if: ${{ inputs.nodejs-version == '' && inputs.bun-versions == '' && inputs.distros == '' }}
run: |
set -e
echo "NODE_VERSIONS_TO_BUILD=$(python check_nodejs.py ${{ env.NODE_MAJOR_VERSIONS_TO_CHECK }})" >> $GITHUB_ENV
echo "BUN_VERSIONS_TO_BUILD=$(python check_bun.py ${{ env.BUN_TAGS_TO_CHECK }})" >> $GITHUB_ENV
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- uses: nick-fields/retry@v3
name: Build and push Docker images
with:
timeout_minutes: 60
max_attempts: 3
retry_on: error
command: ./build-updated.sh
env:
REGISTRY: ${{ env.REGISTRY }}
PLATFORMS: ${{ env.PLATFORMS }}
NODE_VERSIONS_TO_BUILD: ${{ env.NODE_VERSIONS_TO_BUILD || inputs.nodejs-version }}
BUN_VERSIONS_TO_BUILD: ${{ env.BUN_VERSIONS_TO_BUILD || inputs.bun-versions }}
DISTROS: ${{ env.DISTROS || inputs.distros }}
- name: Commit changes
run: ./commit-changes.sh
env:
BUN_VERSIONS_TO_BUILD: ${{ env.BUN_VERSIONS_TO_BUILD }}
NODE_VERSIONS_TO_BUILD: ${{ env.NODE_VERSIONS_TO_BUILD }}
DISTROS: ${{ env.DISTROS }}
- name: Pull changes
run: git pull -r
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}