Skip to content
This repository has been archived by the owner on Nov 22, 2024. It is now read-only.

Commit

Permalink
add github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
M1cha committed Jul 31, 2022
1 parent dd44b7e commit c681045
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Build

on:
push:
branches: [ "main" ]
tags: [ "**" ]
pull_request:
branches: [ "main" ]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
arch:
- amd64
- arm64
steps:
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.18

- name: Build
run: |
GOOS=linux GOARCH=${{matrix.arch}} go build -ldflags "-s -w" -v -o lxdocker cmd/lxdocker/lxdocker.go
GOOS=linux GOARCH=${{matrix.arch}} go build -ldflags "-s -w" -v -o imgserver cmd/imgserver/imgserver.go
- name: Compress
run: tar -cvf lxdocker-linux-${{matrix.arch}}.tar.gz lxdocker imgserver

- name: Upload artifact
uses: actions/upload-artifact@v3
with:
path: lxdocker-linux-${{matrix.arch}}.tar.gz
if-no-files-found: error

deploy:
if: startsWith(github.ref, 'refs/tags/')
needs:
- build
runs-on: ubuntu-latest
steps:
- name: Download all build artifacts
uses: actions/download-artifact@v3

- name: Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
fail_on_unmatched_files: true
files: |
artifact/*.tar.gz

0 comments on commit c681045

Please sign in to comment.