Skip to content

feat: adicionar documentação para funções de controle de fluxo em Go #59

feat: adicionar documentação para funções de controle de fluxo em Go

feat: adicionar documentação para funções de controle de fluxo em Go #59

Workflow file for this run

name: Build, Publish, Tag and Release
on:
workflow_dispatch:
push:
branches:
- main
paths-ignore:
- 'README.md'
- 'LICENSE'
- 'docs/**'
- '.github/**'
jobs:
build_and_push:
name: Build and Push to Docker Hub
environment: DOCKERHUB
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.22.8'
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.USERNAME }}
password: ${{ secrets.ACCESS_TOKEN }}
- name: Build Docker image
run: |
docker build --no-cache --rm \
-t ${{ github.repository }}:v0.1.${{ github.run_number }} \
-f ./build/Dockerfile.prod .
- name: Push Docker image to Docker Hub
run: docker push ${{ github.repository }}:v0.1.${{ github.run_number }}
tag:
name: Tag
environment: GITHUB
needs: build_and_push
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Create and push tag
id: create_tag
run: |
# Define a dynamic tag using the run number and date/time
TAG_NAME="v0.1.${{ github.run_number }}"
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV
# Configure the remote with authentication token
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}
# Create and push the tag
git tag $TAG_NAME
git push origin $TAG_NAME
# Output the tag name
echo "::set-output name=tag_name::$TAG_NAME"
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
outputs:
tag_name: ${{ steps.create_tag.outputs.tag_name }}
release:
name: Release
environment: GITHUB
needs: [build_and_push, tag]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ needs.tag.outputs.tag_name }}
files: aprendago
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
go_proxy:
name: pkg.go.dev
needs: [build_and_push, tag, release]
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.22.8'
- name: Update pkg.go.dev
run: GOPROXY=https://proxy.golang.org go list -m github.com/fabianoflorentino/[email protected].${{ github.run_number }}