feat: Add configuration to exclude repositories from being fetched. (… #65
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
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
release: | |
types: | |
- created | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
include: | |
- goos: darwin | |
goarch: amd64 | |
goopts: "" | |
filename: git-backup-darwin-intel | |
- goos: darwin | |
goarch: arm64 | |
goopts: "" | |
filename: git-backup-darwin-m1 | |
- goos: linux | |
goarch: amd64 | |
goopts: "" | |
filename: git-backup-linux-x64 | |
- goos: linux | |
goarch: arm64 | |
goopts: "" | |
filename: git-backup-linux-arm64 | |
- goos: linux | |
goarch: arm | |
goopts: GOARM=7 | |
filename: git-backup-linux-armv7 | |
- goos: windows | |
goarch: amd64 | |
goopts: "" | |
filename: git-backup-windows-x64.exe | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-go@v2 | |
with: | |
go-version: '^1.18.10' | |
- run: ${{ matrix.goopts }} go build -o ${{ matrix.filename }} -ldflags="-X 'main.Version=${GITHUB_REF##*/}' -X 'main.CommitHash=${GITHUB_SHA}' -X 'main.BuildTimestamp=$(date)'" ./cmd/git-backup | |
env: | |
GOOS: ${{ matrix.goos }} | |
GOARCH: ${{ matrix.goarch }} | |
- uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: ${{ matrix.filename }} | |
- run: mv ${{ matrix.filename }} git-backup | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: binary-${{ matrix.filename }} | |
path: git-backup | |
build_docker: | |
needs: | |
- build | |
name: Build Docker | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/download-artifact@v2 | |
with: | |
name: binary-git-backup-linux-x64 | |
path: linux/amd64/git-backup | |
- uses: actions/download-artifact@v2 | |
with: | |
name: binary-git-backup-linux-armv7 | |
path: linux/arm/v7/git-backup | |
- run: find linux | |
- uses: docker/setup-qemu-action@v1 | |
- uses: docker/setup-buildx-action@v1 | |
- uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v3 | |
with: | |
images: ghcr.io/chappio/git-backup | |
tags: | | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
type=edge,branch=main | |
- uses: docker/build-push-action@v2 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm/v7 | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |