mirror of
https://github.com/cupcakearmy/autorestic.git
synced 2026-04-02 11:55:23 +00:00
Merge 02163fb2d3 into 4d9a2b828e
This commit is contained in:
33
.github/workflows/build.yml
vendored
33
.github/workflows/build.yml
vendored
@@ -6,34 +6,6 @@ on:
|
|||||||
- "v*.*.*"
|
- "v*.*.*"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
docker:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v1
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v1
|
|
||||||
- name: Docker Labels
|
|
||||||
id: meta
|
|
||||||
uses: crazy-max/ghaction-docker-meta@v2
|
|
||||||
with:
|
|
||||||
images: cupcakearmy/autorestic
|
|
||||||
tags: |
|
|
||||||
type=semver,pattern={{version}}
|
|
||||||
type=semver,pattern={{major}}.{{minor}}
|
|
||||||
type=semver,pattern={{major}}
|
|
||||||
- name: Login to DockerHub
|
|
||||||
uses: docker/login-action@v1
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
||||||
- name: Build and push
|
|
||||||
uses: docker/build-push-action@v2
|
|
||||||
with:
|
|
||||||
platforms: linux/amd64,linux/arm64
|
|
||||||
push: true
|
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
|
||||||
|
|
||||||
release:
|
release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
@@ -51,6 +23,9 @@ jobs:
|
|||||||
- name: Release
|
- name: Release
|
||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v1
|
||||||
with:
|
with:
|
||||||
files: dist/*
|
files: |
|
||||||
|
dist/*.bz2
|
||||||
|
dist/*.zip
|
||||||
|
dist/SHA256SUMS
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import (
|
|||||||
"path"
|
"path"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"sync"
|
"sync"
|
||||||
|
"strings"
|
||||||
"github.com/cupcakearmy/autorestic/internal"
|
"github.com/cupcakearmy/autorestic/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -22,6 +22,7 @@ var targets = map[string][]string{
|
|||||||
"linux": {"386", "amd64", "arm", "arm64"},
|
"linux": {"386", "amd64", "arm", "arm64"},
|
||||||
"netbsd": {"386", "amd64"},
|
"netbsd": {"386", "amd64"},
|
||||||
"openbsd": {"386", "amd64"},
|
"openbsd": {"386", "amd64"},
|
||||||
|
"windows": {"386", "amd64"},
|
||||||
}
|
}
|
||||||
|
|
||||||
type buildOptions struct {
|
type buildOptions struct {
|
||||||
@@ -31,6 +32,12 @@ type buildOptions struct {
|
|||||||
func build(options buildOptions, wg *sync.WaitGroup) {
|
func build(options buildOptions, wg *sync.WaitGroup) {
|
||||||
fmt.Printf("Building %s %s\n", options.Target, options.Arch)
|
fmt.Printf("Building %s %s\n", options.Target, options.Arch)
|
||||||
out := fmt.Sprintf("autorestic_%s_%s_%s", options.Version, options.Target, options.Arch)
|
out := fmt.Sprintf("autorestic_%s_%s_%s", options.Version, options.Target, options.Arch)
|
||||||
|
|
||||||
|
// append .exe for Windows
|
||||||
|
if (options.Target == "windows") {
|
||||||
|
out += ".exe"
|
||||||
|
}
|
||||||
|
|
||||||
out = path.Join(DIR, out)
|
out = path.Join(DIR, out)
|
||||||
out, _ = filepath.Abs(out)
|
out, _ = filepath.Abs(out)
|
||||||
fmt.Println(out)
|
fmt.Println(out)
|
||||||
@@ -53,7 +60,17 @@ func build(options buildOptions, wg *sync.WaitGroup) {
|
|||||||
|
|
||||||
// Compress
|
// Compress
|
||||||
{
|
{
|
||||||
c := exec.Command("bzip2", out)
|
var c *exec.Cmd
|
||||||
|
switch options.Target {
|
||||||
|
// use zip for Windows
|
||||||
|
case "windows":
|
||||||
|
zipFile := strings.TrimSuffix(out, ".exe") + ".zip"
|
||||||
|
c = exec.Command("zip", "-j", "-q", "-X", zipFile, out)
|
||||||
|
// use bzip2 for everything else
|
||||||
|
default:
|
||||||
|
c = exec.Command("bzip2", out)
|
||||||
|
}
|
||||||
|
|
||||||
c.Dir = DIR
|
c.Dir = DIR
|
||||||
c.Stdout = os.Stdout
|
c.Stdout = os.Stdout
|
||||||
c.Stderr = os.Stderr
|
c.Stderr = os.Stderr
|
||||||
|
|||||||
Reference in New Issue
Block a user