fix: updated Dockerfile final workdir change #3
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 | |
on: | |
push: | |
branches: ["main"] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: "1.20" | |
- name: Build | |
run: go build -v ./... | |
- name: Test | |
run: go test -v ./... | |
versioning: | |
permissions: | |
contents: write | |
needs: test | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.latest_version.outputs.version }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Git Identity | |
run: | | |
git checkout main | |
git fetch --all --tags | |
git config --global user.email "antoniojosedonishung@gmail.com" | |
git config --global user.name "Antonio Donis" | |
- name: Setup node 18.x | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.x | |
cache: "npm" | |
- name: Changelog | |
run: 'npx standard-version --message "[ci skip] chore(release): %s"' | |
- name: Push changes | |
run: git push --follow-tags --force origin main | |
- id: latest_version | |
name: Latest version | |
run: python version.py >> $GITHUB_OUTPUT | |
release-github: | |
permissions: | |
contents: write | |
packages: write | |
needs: | |
- versioning | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Linux binary | |
run: go build -v -o bin/message-api | |
env: | |
GOOS: linux | |
GOARCH: amd64 | |
- name: Windows binary | |
run: go build -v -o bin/message-api.exe | |
env: | |
GOOS: windows | |
GOARCH: amd64 | |
- name: UPX binaries | |
run: upx bin/* | |
- name: GitHub release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
bin/message-api | |
bin/message-api.exe | |
tag_name: v${{needs.versioning.outputs.version}} | |
release-docker: | |
permissions: | |
contents: read | |
packages: write | |
needs: | |
- versioning | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Docker image | |
run: echo "v${{needs.versioning.outputs.version}}" | |
- name: Log in to the Container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ghcr.io/${{ github.repository }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
push: true | |
tags: ghcr.io/${{ github.repository }}:latest,ghcr.io/${{ github.repository }}:${{needs.versioning.outputs.version}} | |
labels: ${{ steps.meta.outputs.labels }} |