Refactor implementation #13
Workflow file for this run
This file contains hidden or 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: static-server | |
on: | |
pull_request: | |
branches: [ main,development ] | |
push: | |
tags: | |
- 'v*' | |
jobs: | |
test_and_build: | |
runs-on: ubuntu-latest | |
name: Test and Build | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: '1.22' | |
- name: Get dependencies | |
run: go mod download | |
- name: Test | |
run: | | |
go test ./... | |
release_package: | |
if: ${{ startsWith(github.ref, 'refs/tags/v')}} | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.22' | |
- name: Get dependencies | |
run: | | |
go mod download | |
- name: Extract Release Tag | |
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |
- name: Log in to Docker Hub | |
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a | |
with: | |
username: "v4vikash" | |
password: ${{ secrets.DOCKER_HUB_PAT }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v4 | |
with: | |
push: true | |
context: . | |
file: Dockerfile | |
tags: zopdev/static-server:${{ env.RELEASE_VERSION }}, zopdev/static-server:latest |