update ci
This commit is contained in:
parent
2bf6f3c534
commit
c94d7038e9
|
@ -1,6 +1,8 @@
|
|||
name: ci-build
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '**'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
|
@ -19,13 +21,25 @@ jobs:
|
|||
with:
|
||||
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
|
||||
if: ${{ env.REPO_KEY != '' }}
|
||||
with:
|
||||
packages: git-crypt xxd
|
||||
version: 1.0
|
||||
env:
|
||||
REPO_KEY: ${{ secrets.REPO_KEY }}
|
||||
|
||||
- name: decrypt
|
||||
if: ${{ !env.ACT }}
|
||||
if: ${{ env.REPO_KEY != '' }}
|
||||
run: |
|
||||
echo ${REPO_KEY} | xxd -r -p > ../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 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
|
||||
id: build
|
||||
run: python build.py
|
||||
|
||||
- name: Deploy with rsync
|
||||
run: rsync -avz ./updates/ olebeck@${{ secrets.SSH_HOST }}:/var/www/updates/
|
||||
|
||||
- name: 'Get Previous tag'
|
||||
id: previoustag
|
||||
uses: "WyriHaximus/github-action-get-previous-tag@v1"
|
||||
if: ${{ env.SSH_HOST != '' }}
|
||||
run: rsync -avz ./updates/ olebeck@${SSH_HOST}:/var/www/updates/
|
||||
env:
|
||||
SSH_HOST: ${{ secrets.SSH_HOST }}
|
||||
|
||||
- uses: "marvinpinto/action-automatic-releases@latest"
|
||||
with:
|
||||
repo_token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
automatic_release_tag: ${{ steps.previoustag.outputs.tag }}
|
||||
automatic_release_tag: ${{ steps.build.outputs.release_tag }}
|
||||
files: ./builds/*
|
||||
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"
|
||||
APP_ID = "yuv.pink.bedrocktool"
|
||||
TAG = subprocess.run(["git", "describe", "--exclude", "r-*", "--tags", "--always"], stdout=subprocess.PIPE).stdout.decode("utf8").split("\n")[0]
|
||||
if TAG == "":
|
||||
TAG = "v0.0.0"
|
||||
VER = VER_RE.match(TAG).group(1)
|
||||
GIT_TAG = subprocess.run(["git", "describe", "--exclude", "r*", "--tags", "--always"], stdout=subprocess.PIPE).stdout.decode("utf8").split("\n")[0]
|
||||
if GIT_TAG == "":
|
||||
GIT_TAG = "v0.0.0"
|
||||
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:
|
||||
PACK_SUPPORT = f.read(100).count(b"package ") > 0
|
||||
|
||||
print(f"Pack Support: {PACK_SUPPORT}")
|
||||
|
||||
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}"
|
||||
|
||||
tags = []
|
||||
if PACK_SUPPORT:
|
||||
tags.append("packs")
|
||||
|
||||
env = ["GOVCS=*:off"]
|
||||
if not PACK_SUPPORT:
|
||||
tags.append("nopacks")
|
||||
|
||||
if GUI:
|
||||
args = [
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//go:build !nopacks
|
||||
//go:build packs
|
||||
|
||||
package subcommands
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//go:build nopacks
|
||||
//go:build !packs
|
||||
|
||||
package subcommands
|
||||
|
||||
|
|
Loading…
Reference in New Issue