auto build package with tag

This commit is contained in:
Kukks 2023-11-08 10:53:45 +01:00
parent 8d359fb4ce
commit ff86808af4
No known key found for this signature in database
GPG Key ID: 8E5530D9D1C93097
7 changed files with 74 additions and 193 deletions

View File

@ -1,47 +0,0 @@
name: Delete old workflow runs
on:
schedule:
# Run monthly, at 00:00 on the 1st day of month.
- cron: '0 0 1 * *'
workflow_dispatch:
inputs:
days:
description: 'Number of days.'
required: true
default: '30'
minimum_runs:
description: 'The minimum runs to keep for each workflow.'
required: true
default: '6'
delete_workflow_pattern:
description: 'The name or filename of the workflow. if not set then it will target all workflows.'
required: false
delete_workflow_by_state_pattern:
description: 'Remove workflow by state: active, deleted, disabled_fork, disabled_inactivity, disabled_manually'
required: true
default: "All"
type: choice
options:
- "All"
- active
- deleted
- disabled_inactivity
- disabled_manually
dry_run:
description: 'Only log actions, do not perform any delete operations.'
required: false
jobs:
del_runs:
runs-on: ubuntu-latest
steps:
- name: Delete workflow runs
uses: Mattraks/delete-workflow-runs@v2
with:
token: ${{ github.token }}
repository: ${{ github.repository }}
retain_days: ${{ github.event.inputs.days }}
keep_minimum_runs: ${{ github.event.inputs.minimum_runs }}
delete_workflow_pattern: ${{ github.event.inputs.delete_workflow_pattern }}
delete_workflow_by_state_pattern: ${{ github.event.inputs.delete_workflow_by_state_pattern }}
dry_run: ${{ github.event.inputs.dry_run }}

54
.github/workflows/publish-btcpay.yml vendored Normal file
View File

@ -0,0 +1,54 @@
name: Create Release
on:
create:
tags:
- 'BTCPayServer/*'
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up .NET 7
uses: actions/setup-dotnet@v1
with:
dotnet-version: '7.x' # Use .NET 7
- name: Run build script and capture output
run: |
chmod +x $GITHUB_WORKSPACE/build-btcpayplugin.sh
ASSET_PATH=$($GITHUB_WORKSPACE/build-btcpayplugin.sh | tail -1)
echo "ASSET_PATH=$ASSET_PATH" >> $GITHUB_ENV
- name: Verify tag matches asset file name
run: |
TAG_NAME=${GITHUB_REF#refs/tags/BTCPayServer/}
ASSET_BASE_NAME=$(basename $ASSET_PATH .zip)
if [[ "$ASSET_BASE_NAME" != *"$TAG_NAME" ]]; then
echo "Error: Tag name does not match asset file name."
exit 1
fi
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ env.ASSET_PATH }}
asset_name: $(basename ${{ env.ASSET_PATH }})
asset_content_type: application/zip

View File

@ -1,75 +0,0 @@
name: Publish nightly dev Docker image
on:
# Manual trigger
workflow_dispatch:
# At 06:00 AM, on Tuesday, Thursday, and Saturday
schedule:
- cron: "0 6 * * TUE,THU,SAT"
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
jobs:
publish-nightly:
name: Build, Test, Publish and Deploy nightly Docker image
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: 7.0.x
include-prerelease: true
- name: Build
run: dotnet build Smartstore.sln -c Release
- name: Test
run: dotnet test Smartstore.sln -c Release --no-restore --no-build
- name: Log in to the GitHub Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
#- name: Log in to Docker Hub
# uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
# with:
# username: ${{ secrets.DOCKER_USERNAME }}
# password: ${{ secrets.DOCKER_PASSWORD }}
- name: Publish and Push for Linux
if: matrix.os == 'ubuntu-latest'
run: |
dotnet publish src/Smartstore.Web/Smartstore.Web.csproj -c Release -o ./.build/release --no-restore --no-build --no-self-contained
docker build --build-arg SOURCE=./.build/release -f NoBuild.Dockerfile -t ghcr.io/smartstore/smartstore-linux:nightly .
docker push ghcr.io/smartstore/smartstore-linux:nightly
#docker build --build-arg VERSION=nightly -f NoBuild.Dockerfile -t smartstore/smartstore-linux:nightly .
#docker push smartstore/smartstore-linux:nightly
- name: Publish and Push for Windows
if: matrix.os == 'windows-latest'
run: |
dotnet publish src/Smartstore.Web/Smartstore.Web.csproj -c Release -o ./.build/release --no-restore --no-build --no-self-contained
docker build --build-arg SOURCE=./.build/release -f Nano.Dockerfile -t ghcr.io/smartstore/smartstore-windows:nightly .
docker push ghcr.io/smartstore/smartstore-windows:nightly
#docker build --build-arg VERSION=nightly -f NoBuild.Dockerfile -t smartstore/smartstore-windows:nightly .
#docker push smartstore/smartstore-windows:nightly

View File

@ -1,70 +0,0 @@
name: Publish release Docker image
on:
push:
branches:
- '5.0.5.x' # << Change this for new versions.
workflow_dispatch:
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
publish-release:
name: Build, Publish and Deploy stable release Docker image
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Format branch label
id: format-branch-label
run: bash .github/FormatBranchLabel.sh
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x # << Change this to current .NET version.
include-prerelease: false
- name: Build
run: dotnet build Smartstore.sln -c Release
- name: Log in to the GitHub Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Publish and Push for Linux
if: matrix.os == 'ubuntu-latest'
run: |
dotnet publish src/Smartstore.Web/Smartstore.Web.csproj -c Release -o ./.build/release --no-restore --no-build --no-self-contained
docker build --build-arg SOURCE=./.build/release -f NoBuild.Dockerfile -t ghcr.io/smartstore/smartstore-linux:latest -t ghcr.io/smartstore/smartstore-linux:${{ steps.format-branch-label.outputs.branch-label }} .
docker push ghcr.io/smartstore/smartstore-linux:latest
docker push ghcr.io/smartstore/smartstore-linux:${{ steps.format-branch-label.outputs.branch-label }}
- name: Publish and Push for Windows
if: matrix.os == 'windows-latest'
run: |
dotnet publish src/Smartstore.Web/Smartstore.Web.csproj -c Release -o ./.build/release --no-restore --no-build --no-self-contained
docker build --build-arg SOURCE=./.build/release -f Nano.Dockerfile -t ghcr.io/smartstore/smartstore-windows:latest -t ghcr.io/smartstore/smartstore-windows:${{ steps.format-branch-label.outputs.branch-label }} .
docker push ghcr.io/smartstore/smartstore-windows:latest
docker push ghcr.io/smartstore/smartstore-windows:${{ steps.format-branch-label.outputs.branch-label }}

16
build-btcpayplugin.sh Normal file
View File

@ -0,0 +1,16 @@
#!/bin/bash
# Get the directory of the currently running script
StartPath=$(dirname "$0")
# Print the StartPath
echo "$StartPath"
# Build the project
dotnet build "$StartPath/src/Smartstore.Modules/Smartstore.BTCPayServer/Smartstore.BTCPayServer.csproj" -c Release
# Print the path to the PackagerCLI project
echo "$StartPath/tools/Smartstore.PackagerCLI/Smartstore.PackagerCLI.csproj"
# Run the PackagerCLI project
dotnet run --project "$StartPath/tools/Smartstore.PackagerCLI/Smartstore.PackagerCLI.csproj" "$StartPath/src/Smartstore.Web/Modules/Smartstore.BTCPayServer" "$StartPath/build/packages"

View File

@ -4,7 +4,7 @@
"SystemName": "Smartstore.BTCPayServer",
"FriendlyName": "Bitcoin payments with BTCPay Server",
"Description": "This plugin enables Bitcoin payments with your BTCPay Server instance",
"Version": "5.0.6.1",
"Version": "5.0.5",
"MinAppVersion": "5.0.5",
"Author": "Nisaba Solutions",
"Order": 1,

View File

@ -15,6 +15,9 @@
<Content Include="..\..\build-btcpayplugin.ps1">
<Link>build-btcpayplugin.ps1</Link>
</Content>
<Content Include="..\..\build-btcpayplugin.sh">
<Link>build-btcpayplugin.sh</Link>
</Content>
</ItemGroup>
</Project>