update ci
This commit is contained in:
parent
2bf6f3c534
commit
c94d7038e9
|
@ -1,6 +1,8 @@
|
||||||
name: ci-build
|
name: ci-build
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
branches:
|
||||||
|
- '**'
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
@ -19,13 +21,25 @@ jobs:
|
||||||
with:
|
with:
|
||||||
go-version-file: go.mod
|
go-version-file: go.mod
|
||||||
|
|
||||||
|
- name: Install SSH Key
|
||||||
|
if: ${{ env.SSH_PRIVATE_KEY != '' }}
|
||||||
|
uses: shimataro/ssh-key-action@v2
|
||||||
|
with:
|
||||||
|
key: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||||
|
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
env:
|
||||||
|
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||||
|
|
||||||
- uses: awalsh128/cache-apt-pkgs-action@latest
|
- uses: awalsh128/cache-apt-pkgs-action@latest
|
||||||
|
if: ${{ env.REPO_KEY != '' }}
|
||||||
with:
|
with:
|
||||||
packages: git-crypt xxd
|
packages: git-crypt xxd
|
||||||
version: 1.0
|
version: 1.0
|
||||||
|
env:
|
||||||
|
REPO_KEY: ${{ secrets.REPO_KEY }}
|
||||||
|
|
||||||
- name: decrypt
|
- name: decrypt
|
||||||
if: ${{ !env.ACT }}
|
if: ${{ env.REPO_KEY != '' }}
|
||||||
run: |
|
run: |
|
||||||
echo ${REPO_KEY} | xxd -r -p > ../bedrock-repo-key.key
|
echo ${REPO_KEY} | xxd -r -p > ../bedrock-repo-key.key
|
||||||
git-crypt unlock ../bedrock-repo-key.key
|
git-crypt unlock ../bedrock-repo-key.key
|
||||||
|
@ -36,26 +50,19 @@ jobs:
|
||||||
- run: go install github.com/fyne-io/fyne-cross@latest
|
- run: go install github.com/fyne-io/fyne-cross@latest
|
||||||
- run: go get ./cmd/bedrocktool
|
- run: go get ./cmd/bedrocktool
|
||||||
|
|
||||||
- name: Install SSH Key
|
|
||||||
uses: shimataro/ssh-key-action@v2
|
|
||||||
with:
|
|
||||||
key: ${{ secrets.SSH_PRIVATE_KEY }}
|
|
||||||
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
|
||||||
|
|
||||||
- name: build
|
- name: build
|
||||||
id: build
|
id: build
|
||||||
run: python build.py
|
run: python build.py
|
||||||
|
|
||||||
- name: Deploy with rsync
|
- name: Deploy with rsync
|
||||||
run: rsync -avz ./updates/ olebeck@${{ secrets.SSH_HOST }}:/var/www/updates/
|
if: ${{ env.SSH_HOST != '' }}
|
||||||
|
run: rsync -avz ./updates/ olebeck@${SSH_HOST}:/var/www/updates/
|
||||||
- name: 'Get Previous tag'
|
env:
|
||||||
id: previoustag
|
SSH_HOST: ${{ secrets.SSH_HOST }}
|
||||||
uses: "WyriHaximus/github-action-get-previous-tag@v1"
|
|
||||||
|
|
||||||
- uses: "marvinpinto/action-automatic-releases@latest"
|
- uses: "marvinpinto/action-automatic-releases@latest"
|
||||||
with:
|
with:
|
||||||
repo_token: "${{ secrets.GITHUB_TOKEN }}"
|
repo_token: "${{ secrets.GITHUB_TOKEN }}"
|
||||||
automatic_release_tag: ${{ steps.previoustag.outputs.tag }}
|
automatic_release_tag: ${{ steps.build.outputs.release_tag }}
|
||||||
files: ./builds/*
|
files: ./builds/*
|
||||||
prerelease: false
|
prerelease: false
|
||||||
|
|
30
build.py
30
build.py
|
@ -1,20 +1,29 @@
|
||||||
import subprocess, re, sys, os, shutil, json, binascii, hashlib, gzip, stat
|
import subprocess, re, sys, os, shutil, json, binascii, hashlib, gzip
|
||||||
|
|
||||||
VER_RE = re.compile(r"v(\d\.\d+\.\d+)")
|
VER_RE = re.compile(r"v(\d\.\d+\.\d+)(?:-(\d+)-(\w))?")
|
||||||
|
|
||||||
NAME = "bedrocktool"
|
NAME = "bedrocktool"
|
||||||
APP_ID = "yuv.pink.bedrocktool"
|
APP_ID = "yuv.pink.bedrocktool"
|
||||||
TAG = subprocess.run(["git", "describe", "--exclude", "r-*", "--tags", "--always"], stdout=subprocess.PIPE).stdout.decode("utf8").split("\n")[0]
|
GIT_TAG = subprocess.run(["git", "describe", "--exclude", "r*", "--tags", "--always"], stdout=subprocess.PIPE).stdout.decode("utf8").split("\n")[0]
|
||||||
if TAG == "":
|
if GIT_TAG == "":
|
||||||
TAG = "v0.0.0"
|
GIT_TAG = "v0.0.0"
|
||||||
VER = VER_RE.match(TAG).group(1)
|
VER_MATCH = VER_RE.match(GIT_TAG)
|
||||||
|
VER = VER_MATCH.group(1)
|
||||||
|
PATCH = VER_MATCH.group(2) or "0"
|
||||||
|
TAG = f"{VER}-{PATCH}"
|
||||||
|
|
||||||
CI = not not os.getenv("GITLAB_CI")
|
print(f"VER: {VER}")
|
||||||
|
print(f"TAG: {TAG}")
|
||||||
|
|
||||||
|
GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT")
|
||||||
|
|
||||||
|
if GITHUB_OUTPUT:
|
||||||
|
with open(GITHUB_OUTPUT, "a") as f:
|
||||||
|
f.write(f"release_tag=r{VER}\n")
|
||||||
|
|
||||||
|
|
||||||
with open("./subcommands/resourcepack-d/resourcepack-d.go", "rb") as f:
|
with open("./subcommands/resourcepack-d/resourcepack-d.go", "rb") as f:
|
||||||
PACK_SUPPORT = f.read(100).count(b"package ") > 0
|
PACK_SUPPORT = f.read(100).count(b"package ") > 0
|
||||||
|
|
||||||
print(f"Pack Support: {PACK_SUPPORT}")
|
print(f"Pack Support: {PACK_SUPPORT}")
|
||||||
|
|
||||||
LDFLAGS = f"-s -w -X github.com/bedrock-tool/bedrocktool/utils.Version={TAG}"
|
LDFLAGS = f"-s -w -X github.com/bedrock-tool/bedrocktool/utils.Version={TAG}"
|
||||||
|
@ -61,9 +70,10 @@ for (platform_name, archs, ext) in PLATFORMS:
|
||||||
name = f"{NAME}{SUB1}"
|
name = f"{NAME}{SUB1}"
|
||||||
|
|
||||||
tags = []
|
tags = []
|
||||||
|
if PACK_SUPPORT:
|
||||||
|
tags.append("packs")
|
||||||
|
|
||||||
env = ["GOVCS=*:off"]
|
env = ["GOVCS=*:off"]
|
||||||
if not PACK_SUPPORT:
|
|
||||||
tags.append("nopacks")
|
|
||||||
|
|
||||||
if GUI:
|
if GUI:
|
||||||
args = [
|
args = [
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
//go:build !nopacks
|
//go:build packs
|
||||||
|
|
||||||
package subcommands
|
package subcommands
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
//go:build nopacks
|
//go:build !packs
|
||||||
|
|
||||||
package subcommands
|
package subcommands
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue