docs: fix how define additional functions #6
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: Release Version | |
on: | |
push: | |
tags: | |
- "v*" | |
jobs: | |
build: | |
name: Build and Testing | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version-file: "go.mod" | |
- name: Build | |
run: go build -v ./... | |
- name: Test | |
run: go test -v ./... | |
release: | |
name: Publish to Docker Hub | |
runs-on: ubuntu-latest | |
needs: [build] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ vars.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Init tag version name | |
run: | | |
echo "TAG_VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_ENV | |
- name: Build and push docker image | |
run: | | |
sed -i 's/${DOCKERHUB_USERNAME}/${{ vars.DOCKERHUB_USERNAME }}/g' deployments/docker-compose.yaml | |
sed -i 's/${DOCKERHUB_REPOSITORY}/${{ vars.DOCKERHUB_REPOSITORY }}/g' deployments/docker-compose.yaml | |
sed -i 's/${TAG_VERSION}/${{ env.TAG_VERSION }}/g' deployments/docker-compose.yaml | |
sed -i 's/${PORT}/${{ vars.PORT }}/g' deployments/docker-compose.yaml | |
docker compose -f ./deployments/docker-compose.yaml build | |
docker compose -f ./deployments/docker-compose.yaml push | |
- name: Build and push docker image by latest version | |
run: | | |
docker tag ${{ vars.DOCKERHUB_USERNAME }}/${{ vars.DOCKERHUB_REPOSITORY }}:${{ env.TAG_VERSION }} ${{ vars.DOCKERHUB_USERNAME }}/${{ vars.DOCKERHUB_REPOSITORY }}:latest | |
docker push ${{ vars.DOCKERHUB_USERNAME }}/${{ vars.DOCKERHUB_REPOSITORY }}:latest |