Skip to content

chore: update release ci to add nuget source #6

chore: update release ci to add nuget source

chore: update release ci to add nuget source #6

Workflow file for this run

on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
env:
# Stop wasting time caching packages
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
# Disable sending usage data to Microsoft
DOTNET_CLI_TELEMETRY_OPTOUT: true
# MYSQL DB
DB_MYSQL_DATABASE: test_sqlkata
DB_MYSQL_USER: root
DB_MYSQL_PASSWORD: "root"
DB_MYSQL_HOST: localhost
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Verify commit exists in origin/main
run: git branch --remote --contains | grep origin/main
# - name: Extract release notes
# run: |
# git log --pretty=format:'%d %s' ${GITHUB_REF} | perl -pe 's| \(.*tag: v(\d+.\d+.\d+(-preview\d{3})?)(, .*?)*\)|\n## \1\n|g' > RELEASE-NOTES
- name: Set VERSION variable from tag
run: echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV
- name: Build
run: dotnet build --configuration Release /p:Version=${VERSION}
- name: Start MySql
run: |
sudo /etc/init.d/mysql start
mysqladmin -u ${{ env.DB_MYSQL_USER }} -p${{ env.DB_MYSQL_PASSWORD }} password ''
mysql -e 'CREATE DATABASE ${{ env.DB_MYSQL_DATABASE }};' -u${{ env.DB_MYSQL_USER }}
mysql -e 'CREATE TABLE cars(id int primary key auto_increment);' -u${{ env.DB_MYSQL_USER }} ${{ env.DB_MYSQL_DATABASE }}
mysql -e 'SHOW TABLES;' -u${{ env.DB_MYSQL_USER }} ${{ env.DB_MYSQL_DATABASE }}
- name: Test
run: dotnet test --configuration Release /p:Version=${VERSION} --no-build
env:
SQLKATA_MYSQL_HOST: ${{ env.DB_MYSQL_HOST }}
SQLKATA_MYSQL_USER: ${{ env.DB_MYSQL_USER }}
SQLKATA_MYSQL_DB: ${{ env.DB_MYSQL_DATABASE }}
- name: Pack
run: dotnet pack --configuration Release /p:Version=${VERSION} --no-build --output .
- name: Push to Github Packages
run: dotnet nuget push *.${VERSION}.nupkg --skip-duplicate --source https://nuget.pkg.github.com/sqlkata/index.json --api-key ${GITHUB_TOKEN}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Push to Nuget
run: dotnet nuget push *.${VERSION}.nupkg --skip-duplicate --source https://api.nuget.org/v3/index.json --api-key ${NUGET_KEY}
env:
NUGET_KEY: ${{ secrets.NUGET_KEY }}