Update README.md #12
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: Release | |
on: | |
push: | |
tags: ["v*"] | |
branches: ["main"] | |
permissions: | |
contents: write | |
packages: write | |
jobs: | |
docker: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
push: ${{ startsWith(github.ref, 'refs/tags/') }} # Only push on tags | |
tags: | | |
ghcr.io/${{ github.repository }}:latest | |
ghcr.io/${{ github.repository }}:${{ github.sha }} | |
binaries: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: "1.21" | |
- name: Build binaries | |
run: | | |
# Build for each platform | |
GOOS=linux GOARCH=amd64 go build -o pg-archiver-linux-amd64 | |
GOOS=darwin GOARCH=amd64 go build -o pg-archiver-darwin-amd64 | |
GOOS=darwin GOARCH=arm64 go build -o pg-archiver-darwin-arm64 | |
GOOS=windows GOARCH=amd64 go build -o pg-archiver-windows-amd64.exe | |
# Set execute permissions | |
chmod +x pg-archiver-* | |
# Create compressed archives | |
tar czf pg-archiver-linux-amd64.tar.gz pg-archiver-linux-amd64 | |
tar czf pg-archiver-darwin-amd64.tar.gz pg-archiver-darwin-amd64 | |
tar czf pg-archiver-darwin-arm64.tar.gz pg-archiver-darwin-arm64 | |
zip pg-archiver-windows-amd64.zip pg-archiver-windows-amd64.exe | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: | | |
pg-archiver-linux-amd64.tar.gz | |
pg-archiver-darwin-amd64.tar.gz | |
pg-archiver-darwin-arm64.tar.gz | |
pg-archiver-windows-amd64.zip |