v0.1.0 #5
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/seif | |
# REGISTRY_IMAGE: germanorizzo/seif-test | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: '1.22.0' | |
- name: Build dir generation | |
run: mkdir bin/ | |
- name: Modify version | |
run: sed -i 's/v0\.0\.0/${{ github.ref_name }}/g' globals.go | |
working-directory: backend/params | |
- name: Frontend install dependencies | |
run: npm install | |
working-directory: frontend/ | |
- name: Compile Frontend | |
run: npm run build | |
working-directory: frontend/ | |
- name: Compile Backend [linux/amd64] | |
run: | | |
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -tags netgo,osusergo -ldflags '-w -extldflags "-static"' -trimpath | |
tar czf ../bin/seif-${{ github.ref_name }}-linux-amd64.tar.gz seif | |
rm seif | |
working-directory: backend/ | |
- name: Compile Backend [linux/arm64] | |
run: | | |
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -a -tags netgo,osusergo -ldflags '-w -extldflags "-static"' -trimpath | |
tar czf ../bin/seif-${{ github.ref_name }}-linux-arm64.tar.gz seif | |
rm seif | |
working-directory: backend/ | |
- name: Compile Backend [darwin/amd64] | |
run: | | |
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -a -tags netgo,osusergo -ldflags '-w -extldflags "-static"' -trimpath | |
zip -9 ../bin/seif-${{ github.ref_name }}-darwin-arm64.zip seif | |
rm seif | |
working-directory: backend/ | |
- name: Compile Backend [darwin/amd64] | |
run: | | |
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -a -tags netgo,osusergo -ldflags '-w -extldflags "-static"' -trimpath | |
zip -9 ../bin/seif-${{ github.ref_name }}-darwin-amd64.zip seif | |
rm seif | |
working-directory: backend/ | |
- name: Compile Backend [windows/amd64] | |
run: | | |
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -a -tags netgo,osusergo -ldflags '-w -extldflags "-static"' -trimpath | |
zip -9 ../bin/seif-${{ github.ref_name }}-win-amd64.zip seif.exe | |
rm seif.exe | |
working-directory: backend/ | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: artifacts | |
path: bin/ | |
release: | |
needs: build | |
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/seif-${{ github.ref_name }}-linux-amd64.tar.gz | |
asset_name: seif-${{ github.ref_name }}-linux-amd64.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/seif-${{ github.ref_name }}-linux-arm64.tar.gz | |
asset_name: seif-${{ github.ref_name }}-linux-arm64.tar.gz | |
asset_content_type: application/gzip | |
- 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/seif-${{ github.ref_name }}-darwin-arm64.zip | |
asset_name: seif-${{ github.ref_name }}-darwin-arm64.zip | |
asset_content_type: application/zip | |
- 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/seif-${{ github.ref_name }}-darwin-amd64.zip | |
asset_name: seif-${{ github.ref_name }}-darwin-amd64.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/seif-${{ github.ref_name }}-win-amd64.zip | |
asset_name: seif-${{ github.ref_name }}-win-amd64.zip | |
asset_content_type: application/zip | |
build-docker: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: | |
- linux/amd64 | |
- linux/arm64 | |
steps: | |
- name: Prepare | |
run: | | |
platform=${{ matrix.platform }} | |
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Modify version | |
run: sed -i 's/v0\.0\.0/${{ github.ref_name }}/g' globals.go | |
working-directory: backend/params | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY_IMAGE }} | |
- 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 | |
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 }} |