Skip to content

feat(CI - Github Actions): added build new release #11

feat(CI - Github Actions): added build new release

feat(CI - Github Actions): added build new release #11

Workflow file for this run

name: Go
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.22.2'
- name: Start MySQL Docker container
run: |
docker run -d --name mysql \
-p 3308:3306 \
-e MYSQL_ROOT_PASSWORD=root \
-e MYSQL_DATABASE=meu_app_db \
-e MYSQL_USER=meu_app_user \
-e MYSQL_PASSWORD=meu_app_password \
mysql:latest
- name: Build
run: go build -v ./...
- name: Test
run: |
# Aguarde alguns segundos para garantir que o MySQL esteja pronto
sleep 10
# Execute os testes conectando ao banco de dados MySQL
go test -v ./...
- name: Stop MySQL Docker container
run: docker stop mysql
release:
runs-on: ubuntu-latest
needs: build
steps:
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v1.0.0 # Define a tag para o release
release_name: Release v1.0.0 # Nome do release
draft: false
prerelease: false
body: |
## Release Notes
- Adicione notas de release aqui
- Você pode incluir informações sobre as alterações, correções ou melhorias
- name: Upload Build Artifact
uses: actions/upload-artifact@v2
with:
name: golang_migration_system
path: ./golang_migration_system