Release v0.16.1 #19
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: Build and Draft Release | |
on: | |
push: | |
tags: | |
- "*" | |
env: | |
REGISTRY_IMAGE: germanorizzo/ws4sqlite | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: '1.22.0' | |
- name: Modify ws4sqlite.exe | |
run: sed -i 's/v0\.0\.0/${{ github.ref_name }}/g' ws4sqlite.go | |
working-directory: src/ | |
- name: Test | |
run: go test -v -timeout 6m | |
working-directory: src/ | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: '1.22.0' | |
- name: Modify ws4sqlite.exe | |
run: sed -i 's/v0\.0\.0/${{ github.ref_name }}/g' ws4sqlite.go | |
working-directory: src/ | |
- name: Build dir generation | |
run: mkdir bin/ | |
- name: Compile and Pack Artifact [linux/amd64] | |
run: | | |
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath | |
tar czf ../bin/ws4sqlite-${{ github.ref_name }}-linux-amd64.tar.gz ws4sqlite | |
rm ws4sqlite | |
working-directory: src/ | |
- name: Compile and Pack Artifact [linux/arm] | |
run: | | |
CGO_ENABLED=0 GOOS=linux GOARCH=arm go build -trimpath | |
tar czf ../bin/ws4sqlite-${{ github.ref_name }}-linux-arm.tar.gz ws4sqlite | |
rm ws4sqlite | |
working-directory: src/ | |
- name: Compile and Pack Artifact [linux/arm64] | |
run: | | |
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -trimpath | |
tar czf ../bin/ws4sqlite-${{ github.ref_name }}-linux-arm64.tar.gz ws4sqlite | |
rm ws4sqlite | |
working-directory: src/ | |
- name: Compile and Pack Artifact [linux/riscv64] | |
run: | | |
CGO_ENABLED=0 GOOS=linux GOARCH=riscv64 go build -trimpath | |
tar czf ../bin/ws4sqlite-${{ github.ref_name }}-linux-riscv64.tar.gz ws4sqlite | |
rm ws4sqlite | |
working-directory: src/ | |
- name: Compile and Pack Artifact [linux/s390x] | |
run: | | |
CGO_ENABLED=0 GOOS=linux GOARCH=s390x go build -trimpath | |
tar czf ../bin/ws4sqlite-${{ github.ref_name }}-linux-s390x.tar.gz ws4sqlite | |
rm ws4sqlite | |
working-directory: src/ | |
- name: Compile and Pack Artifact [darwin/amd64] | |
run: | | |
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -trimpath | |
zip -9 ../bin/ws4sqlite-${{ github.ref_name }}-darwin-amd64.zip ws4sqlite | |
rm ws4sqlite | |
working-directory: src/ | |
- name: Compile and Pack Artifact [darwin/arm64] | |
run: | | |
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -trimpath | |
zip -9 ../bin/ws4sqlite-${{ github.ref_name }}-darwin-arm64.zip ws4sqlite | |
rm ws4sqlite | |
working-directory: src/ | |
- name: Compile and Pack Artifact [windows/amd64] | |
run: | | |
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -trimpath | |
zip -9 ../bin/ws4sqlite-${{ github.ref_name }}-win-amd64.zip ws4sqlite.exe | |
rm ws4sqlite.exe | |
working-directory: src/ | |
- name: Compile and Pack Artifact [windows/arm64] | |
run: | | |
CGO_ENABLED=0 GOOS=windows GOARCH=arm64 go build -trimpath | |
zip -9 ../bin/ws4sqlite-${{ github.ref_name }}-win-arm64.zip ws4sqlite.exe | |
rm ws4sqlite.exe | |
working-directory: src/ | |
- name: Compile and Pack Artifact [freebsd/amd64] | |
run: | | |
CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 go build -trimpath | |
tar czf ../bin/ws4sqlite-${{ github.ref_name }}-freebsd-amd64.tar.gz ws4sqlite | |
rm ws4sqlite | |
working-directory: src/ | |
- name: Compile and Pack Artifact [freebsd/arm64] | |
run: | | |
CGO_ENABLED=0 GOOS=freebsd GOARCH=arm64 go build -trimpath | |
tar czf ../bin/ws4sqlite-${{ github.ref_name }}-freebsd-arm64.tar.gz ws4sqlite | |
rm ws4sqlite | |
working-directory: src/ | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: artifacts | |
path: bin/ | |
retention-days: 1 | |
release: | |
needs: | |
- build | |
- test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: artifacts | |
path: bin/ | |
- name: Create Draft Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.TOKEN }} | |
with: | |
body: _replace_me_ | |
tag_name: ${{ github.ref_name }} | |
release_name: Version ${{ github.ref_name }} | |
draft: true | |
prerelease: false | |
- name: Release Artifact [linux/amd64] | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: bin/ws4sqlite-${{ github.ref_name }}-linux-amd64.tar.gz | |
asset_name: ws4sqlite-${{ github.ref_name }}-linux-amd64.tar.gz | |
asset_content_type: application/gzip | |
- name: Release Artifact [linux/arm] | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: bin/ws4sqlite-${{ github.ref_name }}-linux-arm.tar.gz | |
asset_name: ws4sqlite-${{ github.ref_name }}-linux-arm.tar.gz | |
asset_content_type: application/gzip | |
- name: Release Artifact [linux/arm64] | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: bin/ws4sqlite-${{ github.ref_name }}-linux-arm64.tar.gz | |
asset_name: ws4sqlite-${{ github.ref_name }}-linux-arm64.tar.gz | |
asset_content_type: application/gzip | |
- name: Release Artifact [linux/riscv64] | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: bin/ws4sqlite-${{ github.ref_name }}-linux-riscv64.tar.gz | |
asset_name: ws4sqlite-${{ github.ref_name }}-linux-riscv64.tar.gz | |
asset_content_type: application/gzip | |
- name: Release Artifact [linux/s390x] | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: bin/ws4sqlite-${{ github.ref_name }}-linux-s390x.tar.gz | |
asset_name: ws4sqlite-${{ github.ref_name }}-linux-s390x.tar.gz | |
asset_content_type: application/gzip | |
- name: Release Artifact [darwin/amd64] | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: bin/ws4sqlite-${{ github.ref_name }}-darwin-amd64.zip | |
asset_name: ws4sqlite-${{ github.ref_name }}-darwin-amd64.zip | |
asset_content_type: application/zip | |
- name: Release Artifact [darwin/arm64] | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: bin/ws4sqlite-${{ github.ref_name }}-darwin-arm64.zip | |
asset_name: ws4sqlite-${{ github.ref_name }}-darwin-arm64.zip | |
asset_content_type: application/zip | |
- name: Release Artifact [windows/amd64] | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: bin/ws4sqlite-${{ github.ref_name }}-win-amd64.zip | |
asset_name: ws4sqlite-${{ github.ref_name }}-win-amd64.zip | |
asset_content_type: application/zip | |
- name: Release Artifact [windows/arm64] | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: bin/ws4sqlite-${{ github.ref_name }}-win-arm64.zip | |
asset_name: ws4sqlite-${{ github.ref_name }}-win-arm64.zip | |
asset_content_type: application/zip | |
- name: Release Artifact [freebsd/amd64] | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: bin/ws4sqlite-${{ github.ref_name }}-freebsd-amd64.tar.gz | |
asset_name: ws4sqlite-${{ github.ref_name }}-freebsd-amd64.tar.gz | |
asset_content_type: application/gzip | |
- name: Release Artifact [freebsd/arm64] | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: bin/ws4sqlite-${{ github.ref_name }}-freebsd-arm64.tar.gz | |
asset_name: ws4sqlite-${{ github.ref_name }}-freebsd-arm64.tar.gz | |
asset_content_type: application/gzip | |
# https://docs.docker.com/build/ci/github-actions/multi-platform/ | |
build-docker: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: | |
- linux/amd64 | |
- linux/arm/v7 | |
- linux/arm64 | |
steps: | |
- name: Prepare | |
run: | | |
platform=${{ matrix.platform }} | |
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Modify ws4sqlite.exe | |
run: sed -i 's/v0\.0\.0/${{ github.ref_name }}/g' ws4sqlite.go | |
working-directory: src/ | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY_IMAGE }} | |
# - name: Set up QEMU | |
# uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push by digest | |
id: build | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
platforms: ${{ matrix.platform }} | |
labels: ${{ steps.meta.outputs.labels }} | |
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true | |
- name: Export digest | |
run: | | |
mkdir -p /tmp/digests | |
digest="${{ steps.build.outputs.digest }}" | |
touch "/tmp/digests/${digest#sha256:}" | |
- name: Upload digest | |
uses: actions/upload-artifact@v4 | |
with: | |
name: digests-${{ env.PLATFORM_PAIR }} | |
path: /tmp/digests/* | |
if-no-files-found: error | |
retention-days: 1 | |
merge-docker: | |
runs-on: ubuntu-latest | |
needs: | |
- build-docker | |
- test | |
steps: | |
- name: Download digests | |
uses: actions/download-artifact@v4 | |
with: | |
path: /tmp/digests | |
pattern: digests-* | |
merge-multiple: true | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY_IMAGE }} | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Create manifest list and push | |
working-directory: /tmp/digests | |
run: | | |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ | |
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *) | |
- name: Inspect image | |
run: | | |
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }} |