Refactor with minor improvements, and add README #60
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Go | |
on: | |
- push | |
- pull_request | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ^1.21 | |
id: go | |
- uses: actions/checkout@v4 | |
- name: Get dependencies | |
run: | | |
go get -v -t -d ./... | |
if [ -f Gopkg.toml ]; then | |
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh | |
dep ensure | |
fi | |
- name: Build | |
run: make | |
env: | |
CGO_ENABLED: 0 | |
- name: Test | |
run: | | |
sudo rm -rf /etc/ssh/sshd_config.d/*.conf | |
make test | |
env: | |
CGO_ENABLED: 0 | |
- name: Create GitHub Release | |
if: startsWith(github.ref, 'refs/tags/') | |
id: upload-release-asset | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
sshmux | |
config.example.json | |
sshmux.service | |
docker: | |
name: Docker | |
runs-on: ubuntu-latest | |
steps: | |
- name: Compute Docker metadata | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
ghcr.io/${{ github.repository_owner }}/sshmux | |
tags: | | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GHCR | |
if: startsWith(github.ref, 'refs/tags/') | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ github.token }} | |
- name: Build and push image | |
uses: docker/build-push-action@v6 | |
with: | |
push: ${{ startsWith(github.ref, 'refs/tags/') }} | |
platforms: linux/amd64,linux/arm64 | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |