Update README and invocation #4
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 Publish | |
on: | |
push: | |
tags: | |
- 'v*.*.*' | |
jobs: | |
tests: | |
uses: ./.github/workflows/tests.yaml | |
release: | |
name: Release wpex ${{ github.ref_name }} | |
runs-on: ubuntu-latest | |
needs: [ tests ] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Create Release | |
id: create-release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref_name }} | |
draft: false | |
prerelease: false | |
outputs: | |
upload_url: ${{ steps.create-release.outputs.upload_url }} | |
docker: | |
name: Build and Publish Docker Image | |
runs-on: ubuntu-latest | |
needs: [ release ] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
ghcr.io/${{ github.repository_owner }}/wpex | |
tags: | | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Get Version | |
id: version | |
run: echo version=${GITHUB_REF##*v} >> $GITHUB_OUTPUT | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
build-args: WPEX_VERSION=${{ steps.version.outputs.version }} | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
binary: | |
name: Build and Publish Pre-built binaries | |
runs-on: ubuntu-latest | |
needs: [ release ] | |
strategy: | |
matrix: | |
GOOS: [ darwin, linux, windows ] | |
GOARCH: [ 386, amd64, arm64 ] | |
exclude: | |
- GOOS: darwin | |
GOARCH: 386 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Golang | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.21' | |
- name: Get Version | |
id: version | |
run: echo version=${GITHUB_REF##*v} >> $GITHUB_OUTPUT | |
- name: Build wpex | |
run: >- | |
CGO_ENABLED=0 | |
GOOS=${{ matrix.GOOS }} | |
GOARCH=${{ matrix.GOARCH }} | |
go build -ldflags="-w -s -X main.version=${{ steps.version.outputs.version }}" -o wpex | |
- name: Upload Release Asset | |
id: upload-release-asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.release.outputs.upload_url }} | |
asset_path: ./wpex | |
asset_name: wpex_${{ steps.version.outputs.version }}_${{ matrix.GOOS }}_${{ matrix.GOARCH }} | |
asset_content_type: application/zip |