Skip to content

Commit

Permalink
Reverting more temporary changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Piedone committed Apr 10, 2024
1 parent eaa3c6c commit f94ec35
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 3 deletions.
32 changes: 31 additions & 1 deletion .github/workflows/preview_ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
name: Preview - CI
on:
pull_request:
workflow_dispatch:
schedule:
# 4:19 AM UTC every day. A random time to avoid peak times of GitHub Actions.
Expand All @@ -14,21 +13,35 @@ jobs:
name: Build, Test, Deploy
steps:
- uses: actions/checkout@v4
- name: Check if should publish
id: check-publish
shell: pwsh
run: |
$hasCommitFromLastDay = ![string]::IsNullOrEmpty((git log --oneline --since '24 hours ago'))
Write-Output "Commits found in the last 24 hours: $hasCommitFromLastDay."
$shouldPublish = $hasCommitFromLastDay -and '${{ github.event_name }}' -eq 'schedule'
"should-publish=$($shouldPublish ? 'true' : 'false')" >> $Env:GITHUB_OUTPUT
- uses: actions/setup-node@v4
if: steps.check-publish.outputs.should-publish == 'true'
with:
node-version: "15"
- uses: actions/setup-dotnet@v4
if: steps.check-publish.outputs.should-publish == 'true'
with:
dotnet-version: '8.0.x'
- name: Set build number
if: steps.check-publish.outputs.should-publish == 'true'
run: echo "BuildNumber=$(( $GITHUB_RUN_NUMBER + 16368 ))" >> $GITHUB_ENV
- name: Build
if: steps.check-publish.outputs.should-publish == 'true'
run: |
dotnet build -c Release
- name: Unit Tests
if: steps.check-publish.outputs.should-publish == 'true'
run: |
dotnet test -c Release --no-build ./test/OrchardCore.Tests/OrchardCore.Tests.csproj
- name: Functional Tests
if: steps.check-publish.outputs.should-publish == 'true'
run: |
cd test/OrchardCore.Tests.Functional
npm install
Expand All @@ -41,10 +54,27 @@ jobs:
path: |
test/OrchardCore.Tests.Functional/cms-tests/cypress/screenshots
src/OrchardCore.Cms.Web/App_Data_Tests/logs
- name: Deploy preview NuGet packages
if: steps.check-publish.outputs.should-publish == 'true'
run: |
dotnet pack -c Release --no-build
dotnet nuget push './src/**/*.nupkg' -t 600 -k ${{secrets.CLOUDSMITH_API_KEY}} -n -s https://nuget.cloudsmith.io/orchardcore/preview/v3/index.json --skip-duplicate
- name: Set up Docker Buildx
if: steps.check-publish.outputs.should-publish == 'true'
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
if: steps.check-publish.outputs.should-publish == 'true'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Deploy preview Docker images
if: steps.check-publish.outputs.should-publish == 'true'
shell: pwsh
run: |
Get-ChildItem ./src/OrchardCore.Cms.Web/App_Data -Recurse | Remove-Item -Recurse -Confirm:$false
Get-ChildItem ./src/OrchardCore.Cms.Web/App_Data_Tests -Recurse | Remove-Item -Recurse -Confirm:$false
$output = [System.IO.Path]::GetFullPath("./.build/release")
dotnet publish -c Release --property:PublishDir=$output --no-build --framework net8.0
docker buildx build -f Dockerfile-CI --platform=linux/amd64 -t orchardproject/orchardcore-cms-linux:dev --push .
docker buildx build -f Dockerfile-CI --platform=windows/amd64 -t orchardproject/orchardcore-cms-windows:dev --push .
18 changes: 16 additions & 2 deletions .github/workflows/release_ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
name: Release - CI
on:
pull_request:
push:
paths-ignore:
- '**/*.md'
Expand Down Expand Up @@ -60,6 +59,11 @@ jobs:
path: |
test/OrchardCore.Tests.Functional/cms-tests/cypress/screenshots
src/OrchardCore.Cms.Web/App_Data_Tests/logs
- name: Deploy release NuGet packages
if: matrix.os == 'ubuntu-latest'
run: |
dotnet pack -c Release --no-build -p:Version=${{ steps.get_version.outputs.VERSION }} -p:TreatWarningsAsErrors=false
dotnet nuget push './src/**/*.nupkg' -t 600 -k ${{secrets.NUGET_API_KEY}} -s https://api.nuget.org/v3/index.json --skip-duplicate
- name: Set up Docker Buildx
if: matrix.os == 'ubuntu-latest'
uses: docker/setup-buildx-action@v3
Expand All @@ -68,4 +72,14 @@ jobs:
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Deploy release docker images
if: matrix.os == 'ubuntu-latest'
shell: pwsh
run: |
Get-ChildItem ./src/OrchardCore.Cms.Web/App_Data -Recurse | Remove-Item -Recurse -Confirm:$false
Get-ChildItem ./src/OrchardCore.Cms.Web/App_Data_Tests -Recurse | Remove-Item -Recurse -Confirm:$false
$output = [System.IO.Path]::GetFullPath("./.build/release")
dotnet publish -c Release --property:PublishDir=$output --no-build --framework net8.0
docker buildx build -f Dockerfile-CI --platform=linux/amd64 -t orchardproject/orchardcore-cms-linux:latest -t orchardproject/orchardcore-cms-linux:${{ steps.get_version.outputs.VERSION }} --push .
docker buildx build -f Dockerfile-CI --platform=windows/amd64 -t orchardproject/orchardcore-cms-windows:latest -t orchardproject/orchardcore-cms-windows:${{ steps.get_version.outputs.VERSION }} --push .

0 comments on commit f94ec35

Please sign in to comment.