Skip to content

Commit

Permalink
Add build and release action
Browse files Browse the repository at this point in the history
  • Loading branch information
Loupeznik authored Oct 12, 2024
1 parent b2bafad commit bfc44ac
Showing 1 changed file with 78 additions and 0 deletions.
78 changes: 78 additions & 0 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: CI/CD

on:
push:
branches: ["master", "devel"]
tags: ["v*.*.*"]
pull_request:
branches: ["master"]

permissions:
contents: write

jobs:
build:
name: Build
runs-on: ubuntu-latest
env:
GO111MODULE: on

steps:
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: "1.23"

- name: Install dependencies
run: go get -d

- name: Build
shell: pwsh
run: ./build.ps1

- uses: actions/upload-artifact@v3.1.2
with:
name: artifact
path: ./bin/*

release:
name: Release
needs: build
if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/')}}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: actions/download-artifact@v4
with:
name: artifact
path: output

- name: Create a release
uses: softprops/action-gh-release@v1
with:
files: |
output/**/*
generate_release_notes: true
name: "${{ github.ref_name }}"

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Log in to the Container registry
uses: docker/login-action@v2.1.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v4.0.0
with:
context: .
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: true
tags: |
loupeznik/better-wapi:${{ github.ref_name }}
loupeznik/better-wapi:latest

0 comments on commit bfc44ac

Please sign in to comment.