chore: move workflow folder to gitea [skip ci]
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
name: Deploy
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths-ignore:
|
||||
- ".github/**"
|
||||
- ".vscode/**"
|
||||
- ".gitignore"
|
||||
- ".editorconfig"
|
||||
- "LICENSE.md"
|
||||
- "docker-compose.dev.yml"
|
||||
- "docker-compose.prod.yml"
|
||||
- "**/*/README.md"
|
||||
- "**/*/Dockerfile"
|
||||
- "scripts/**"
|
||||
jobs:
|
||||
build:
|
||||
name: Build and push Docker image
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
version: ${{ steps.version.outputs.version }}
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v7
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v4
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
- name: Create version tag
|
||||
id: version
|
||||
run: echo "version=$(date +%Y.%m.%d.%H%M%S)" >> $GITHUB_OUTPUT
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v4
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v4
|
||||
- name: Build and push server image
|
||||
uses: docker/build-push-action@v7
|
||||
with:
|
||||
context: src/Blog
|
||||
platforms: linux/arm64
|
||||
push: true
|
||||
tags: ${{ secrets.DOCKERHUB_USERNAME }}/blog.stevanfreeborn.com:${{ steps.version.outputs.version }}
|
||||
deploy:
|
||||
name: Deploy to server
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v7
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Copy files to server
|
||||
uses: appleboy/scp-action@v0.1.7
|
||||
with:
|
||||
host: ${{ secrets.SSH_HOST }}
|
||||
username: ${{ secrets.SSH_USERNAME }}
|
||||
key: ${{ secrets.SSH_KEY }}
|
||||
source: "scripts/deploy.ps1"
|
||||
target: blog.stevanfreeborn.com
|
||||
strip_components: 1
|
||||
rm: true
|
||||
- name: Run deploy script
|
||||
uses: appleboy/ssh-action@master
|
||||
with:
|
||||
host: ${{ secrets.SSH_HOST }}
|
||||
username: ${{ secrets.SSH_USERNAME }}
|
||||
key: ${{ secrets.SSH_KEY }}
|
||||
script: |
|
||||
chmod +x blog.stevanfreeborn.com/deploy.ps1
|
||||
sudo pwsh ./blog.stevanfreeborn.com/deploy.ps1 ${{ needs.build.outputs.version }}
|
||||
@@ -0,0 +1,66 @@
|
||||
name: Pull Request
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
paths-ignore:
|
||||
- '.github/**'
|
||||
- '.vscode/**'
|
||||
- '.gitignore'
|
||||
- '.editorconfig'
|
||||
- 'LICENSE.md'
|
||||
- 'docker-compose.dev.yml'
|
||||
- 'docker-compose.prod.yml'
|
||||
- '**/*/README.md'
|
||||
- '**/*/Dockerfile'
|
||||
- 'scripts/**'
|
||||
jobs:
|
||||
run_tests:
|
||||
name: Run tests
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v7
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v5
|
||||
with:
|
||||
dotnet-version: 10.0.x
|
||||
- name: Setup PowerShell (Ubuntu)
|
||||
shell: bash
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y wget apt-transport-https software-properties-common
|
||||
wget -q "https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/packages-microsoft-prod.deb"
|
||||
dpkg -i packages-microsoft-prod.deb
|
||||
apt-get update
|
||||
apt-get install -y powershell
|
||||
- name: Install report generator
|
||||
run: |
|
||||
dotnet tool install --tool-path ./.tools dotnet-reportgenerator-globaltool
|
||||
echo "$PWD/.tools" >> "$GITHUB_PATH"
|
||||
- name: Restore dependencies
|
||||
run: dotnet restore
|
||||
- name: Build project
|
||||
run: dotnet build --no-restore
|
||||
- name: Install playwright dependencies
|
||||
shell: pwsh
|
||||
run: ./test/Blog.Tests/bin/Debug/net10.0/playwright.ps1 install-deps
|
||||
- name: Install playwright
|
||||
shell: pwsh
|
||||
run: ./test/Blog.Tests/bin/Debug/net10.0/playwright.ps1 install
|
||||
- name: Install msedge
|
||||
shell: pwsh
|
||||
run: ./test/Blog.Tests/bin/Debug/net10.0/playwright.ps1 install msedge
|
||||
- name: Test project
|
||||
run: dotnet test -e DOTNET_ENVIRONMENT=CI --no-build --verbosity normal -s ./test/Blog.Tests/ci.runsettings
|
||||
- name: Upload test results
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: test-results
|
||||
path: ./test/Blog.Tests/TestResults
|
||||
- name: Upload playwright traces
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: playwright-traces
|
||||
path: ./test/Blog.Tests/bin/Debug/net10.0/playwright-traces
|
||||
Reference in New Issue
Block a user