Skip to content

Commit c3c5c21

Browse files
committed
Add workflow
1 parent f4c429f commit c3c5c21

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: "virtualmin.dev: virtualmin/virtualmin-install"
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
release:
8+
types:
9+
- published
10+
- edited
11+
12+
env:
13+
GH_REPO: ${{ github.repository }}
14+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
15+
16+
IS_RELEASE: ${{ github.event_name == 'release' }}
17+
18+
BUILD_DEPS: "curl"
19+
BUILD_BOOTSTRAP: "https://raw.githubusercontent.com/webmin/webmin-ci-cd/main/build/bootstrap.bash"
20+
21+
jobs:
22+
build-amd64:
23+
runs-on: ubuntu-latest
24+
if: ${{ !contains(github.event.head_commit.message, '[no-build]') }}
25+
env:
26+
TZ: Europe/Nicosia
27+
steps:
28+
- name: Checkout code
29+
uses: actions/checkout@v4
30+
31+
- uses: awalsh128/cache-apt-pkgs-action@latest
32+
with:
33+
packages: ${{ env.BUILD_DEPS }}
34+
version: 1.0
35+
36+
- name: Fetch dependencies
37+
run: curl -O ${{ env.BUILD_BOOTSTRAP }}
38+
39+
- name: Set timezone
40+
run: sudo timedatectl set-timezone ${{ env.TZ }}
41+
42+
- name: Upload file
43+
env:
44+
CLOUD__GPG_PH: ${{ secrets.DEV_GPG_PH }}
45+
CLOUD__IP_ADDR: ${{ secrets.DEV_IP_ADDR }}
46+
CLOUD__IP_KNOWN_HOSTS: ${{ secrets.DEV_IP_KNOWN_HOSTS }}
47+
CLOUD__UPLOAD_SSH_USER: ${{ secrets.DEV_UPLOAD_SSH_USER }}
48+
CLOUD__UPLOAD_SSH_DIR: ${{ env.IS_RELEASE == 'true' && secrets.PRERELEASE_UPLOAD_SSH_DIR || secrets.DEV_UPLOAD_SSH_DIR }}
49+
CLOUD__SSH_PRV_KEY: ${{ secrets.DEV_SSH_PRV_KEY }}
50+
CLOUD__SIGN_BUILD_REPOS_CMD: ${{ secrets.DEV_SIGN_BUILD_REPOS_CMD }}
51+
run: |-
52+
53+
# Fail on error
54+
set -euo pipefail
55+
56+
# Bootstrap build
57+
source bootstrap.bash $([[ "$IS_RELEASE" == "true" ]] || echo "--testing")
58+
59+
# Get package version and testing flag
60+
pkg_version=$(get_remote_git_tag_version "$GH_REPO" "$GH_TOKEN" "$IS_RELEASE")
61+
62+
# Prepare build
63+
virtualmin_install_versioned="virtualmin-install-$pkg_version.sh"
64+
cp -p virtualmin-install.sh "$virtualmin_install_versioned"
65+
66+
# Delete previous versions and upload new files
67+
upload_list=("virtualmin-install.sh" "$virtualmin_install_versioned")
68+
delete_list=("$CLOUD_UPLOAD_SSH_DIR virtualmin-install * *sh")
69+
cloud_upload upload_list delete_list

0 commit comments

Comments
 (0)