diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 63c8b64..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: "Build - action" - -on: [push, pull_request] - -jobs: - build-docker-image: - name: "Buildscript Docker" - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - - name: Run build.bash - env: - CR_OWNER: ${{secrets.CR_OWNER}} - CR_PASSWORD: ${{secrets.CR_PASSWORD}} - CR_USER: ${{secrets.CR_USER}} - GHCR_OWNER: ${{secrets.GHCR_OWNER}} - GHCR_PAT: ${{secrets.GHCR_PAT}} - GHCR_USER: ${{secrets.GHCR_USER}} - run: ./build.bash diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..10c1143 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,24 @@ +name: ci +run-name: ${{ github.actor }} is running ci + +on: [push, pull_request] + +jobs: + build-docker-image: + name: "Build Docker image" + permissions: + packages: write + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Run build.bash + env: + CR_HOST: ${{secrets.CR_HOST}} + CR_OWNER: ${{secrets.CR_OWNER}} + CR_PASSWORD: ${{secrets.CR_PASSWORD}} + CR_USER: ${{secrets.CR_USER}} + GITHUB_REPOSITORY: ${{ github.repository }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: ./build.bash -p diff --git a/.gitignore b/.gitignore index 1ee5385..d2e1206 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ ## Ignore Visual Studio temporary files, build results, and ## files generated by popular Visual Studio add-ons. ## -## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore +## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore # User-specific files *.rsuser @@ -9,6 +9,7 @@ *.user *.userosscache *.sln.docstates +*.env # User-specific files (MonoDevelop/Xamarin Studio) *.userprefs @@ -21,17 +22,37 @@ mono_crash.* [Dd]ebugPublic/ [Rr]elease/ [Rr]eleases/ -x64/ -x86/ + +[Dd]ebug/x64/ +[Dd]ebugPublic/x64/ +[Rr]elease/x64/ +[Rr]eleases/x64/ +bin/x64/ +obj/x64/ + +[Dd]ebug/x86/ +[Dd]ebugPublic/x86/ +[Rr]elease/x86/ +[Rr]eleases/x86/ +bin/x86/ +obj/x86/ + [Ww][Ii][Nn]32/ [Aa][Rr][Mm]/ [Aa][Rr][Mm]64/ +[Aa][Rr][Mm]64[Ee][Cc]/ bld/ -[Bb]in/ [Oo]bj/ +[Oo]ut/ [Ll]og/ [Ll]ogs/ +# Build results on 'Bin' directories +**/[Bb]in/* +# Uncomment if you have tasks that rely on *.refresh files to move binaries +# (https://github.com/github/gitignore/pull/3736) +#!**/[Bb]in/*.refresh + # Visual Studio 2015/2017 cache/options directory .vs/ # Uncomment if you have tasks that create the project's static files in wwwroot @@ -43,12 +64,16 @@ Generated\ Files/ # MSTest test Results [Tt]est[Rr]esult*/ [Bb]uild[Ll]og.* +*.trx # NUnit *.VisualState.xml TestResult.xml nunit-*.xml +# Approval Tests result files +*.received.* + # Build Results of an ATL Project [Dd]ebugPS/ [Rr]eleasePS/ @@ -75,6 +100,7 @@ StyleCopReport.xml *.ilk *.meta *.obj +*.idb *.iobj *.pch *.pdb @@ -82,6 +108,8 @@ StyleCopReport.xml *.pgc *.pgd *.rsp +# but not Directory.Build.rsp, as it configures directory-level build defaults +!Directory.Build.rsp *.sbr *.tlb *.tli @@ -90,6 +118,7 @@ StyleCopReport.xml *.tmp_proj *_wpftmp.csproj *.log +*.tlog *.vspscc *.vssscc .builds @@ -152,6 +181,7 @@ coverage*.info # NCrunch _NCrunch_* +.NCrunch_* .*crunch*.local.xml nCrunchTemp_* @@ -293,6 +323,14 @@ node_modules/ # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) *.vbw +# Visual Studio 6 workspace and project file (working project files containing files to include in project) +*.dsw +*.dsp + +# Visual Studio 6 technical files +*.ncb +*.aps + # Visual Studio LightSwitch build output **/*.HTMLClient/GeneratedArtifacts **/*.DesktopClient/GeneratedArtifacts @@ -302,22 +340,22 @@ node_modules/ _Pvt_Extensions # Paket dependency manager -.paket/paket.exe +**/.paket/paket.exe paket-files/ # FAKE - F# Make -.fake/ +**/.fake/ # CodeRush personal settings -.cr/personal +**/.cr/personal # Python Tools for Visual Studio (PTVS) -__pycache__/ +**/__pycache__/ *.pyc # Cake - Uncomment if you are using it -# tools/** -# !tools/packages.config +#tools/** +#!tools/packages.config # Tabs Studio *.tss @@ -339,15 +377,22 @@ ASALocalRun/ # MSBuild Binary and Structured Log *.binlog +MSBuild_Logs/ + +# AWS SAM Build and Temporary Artifacts folder +.aws-sam # NVidia Nsight GPU debugger configuration file *.nvuser # MFractors (Xamarin productivity tool) working folder -.mfractor/ +**/.mfractor/ # Local History for Visual Studio -.localhistory/ +**/.localhistory/ + +# Visual Studio History (VSHistory) files +.vshistory/ # BeatPulse healthcheck temp database healthchecksdb @@ -356,7 +401,121 @@ healthchecksdb MigrationBackup/ # Ionide (cross platform F# VS Code tools) working folder -.ionide/ +**/.ionide/ # Fody - auto-generated XML schema FodyWeavers.xsd + +# VS Code files for those working on multiple tools +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +!.vscode/*.code-snippets + +# Local History for Visual Studio Code +.history/ + +# Built Visual Studio Code Extensions +*.vsix + +# Windows Installer files from build outputs +*.cab +*.msi +*.msix +*.msm +*.msp + +### https://github.com/github/gitignore/blob/main/Global/Linux.gitignore +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# Metadata left by Dolphin file manager, which comes with KDE Plasma +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +# Log files created by default by the nohup command +nohup.out + +### https://github.com/github/gitignore/blob/main/Global/macOS.gitignore +# General +.DS_Store +__MACOSX/ +.AppleDouble +.LSOverride +Icon[] + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### https://github.com/github/gitignore/blob/main/Global/Vim.gitignore +# Swap +[._]*.s[a-v][a-z] +# comment out the next line if you don't need vector files +!*.svg +[._]*.sw[a-p] +[._]s[a-rt-v][a-z] +[._]ss[a-gi-z] +[._]sw[a-p] + +# Session +Session.vim +Sessionx.vim + +# Temporary +.netrwhist +*~ +# Auto-generated tag files +tags +# Persistent undo +[._]*.un~ + +### https://github.com/github/gitignore/blob/main/Global/Windows.gitignore +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f4de15..ee0732d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [1.3.1] - 2025-09-17 + +- Update Docker sample build to use ASP.NET 8.0 +- Add missing CR_HOST to GitHub build workflow +- Add note to README about using Gitea + ## [1.3.0] - 2023-06-21 ### Changed diff --git a/Dockerfile b/Dockerfile index ce27064..dd8bcc8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,9 @@ # prepare base image -FROM mcr.microsoft.com/dotnet/runtime:7.0 AS base +FROM mcr.microsoft.com/dotnet/runtime:8.0 AS base WORKDIR /app # get build image -FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build +FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build WORKDIR /src # run dotnet restore diff --git a/README.md b/README.md index 080f48c..b6823ca 100644 --- a/README.md +++ b/README.md @@ -45,9 +45,10 @@ Environment variables (all are optional): 1. Get credentials for pushing containers into your desired registry or registries. -- GitHub [Personal Access Token for the GitHub Container Registry](https://docs.github.com/en/free-pro-team@latest/packages/guides/pushing-and-pulling-docker-images#authenticating-to-github-container-registry). -- Docker Hub [Personal Access Token](https://docs.docker.com/docker-hub/access-tokens/). - Azure container registry [credentials](https://azure.microsoft.com/en-us/services/container-registry/). +- Docker Hub [Personal Access Token](https://docs.docker.com/docker-hub/access-tokens/). +- GitHub [Personal Access Token for the GitHub Container Registry](https://docs.github.com/en/free-pro-team@latest/packages/guides/pushing-and-pulling-docker-images#authenticating-to-github-container-registry). +- Gitea [Authentication](https://docs.gitea.com/development/api-usage#authentication) #### Set up your Dockerfile @@ -73,8 +74,9 @@ See [this sample Dockerfile](https://github.com/mcld/buildscript/blob/main/Docke - Review sample CI configurations: - - [GitHub Action](https://github.com/mcld/buildscript/blob/main/.github/workflows/build.yml) - [Azure Pipeline](https://github.com/mcld/buildscript/blob/main/azure-pipelines.yml) + - [GitHub Action](https://github.com/mcld/buildscript/blob/main/.github/workflows/build.yml) + - [Gitea Action](https://docs.gitea.com/usage/actions/overview) - Gitea is able to use the GitHub action listed above or a workflow in .gitlab/workflows - Push some branches and open and resolve some PRs to see if the build works successfully. diff --git a/build.bash b/build.bash index 91398ce..da4eed7 100755 --- a/build.bash +++ b/build.bash @@ -199,10 +199,10 @@ if [[ -z ${BLD_DOCKER_IMAGE-} ]]; then fi # Perform release prep if necessary and script is present -if [[ $BLD_RELEASE = "true" && -f "release-prep.bash" ]]; then +if [[ $BLD_RELEASE = "true" && -x "release-prep.bash" ]]; then msg "${BLUE}===${NOFORMAT} Running release preparation for version $BLD_RELEASE_VERSION" #shellcheck disable=SC1091 - source release-prep.bash + ./release-prep.bash msg "${GREEN}===${NOFORMAT} Release preparation script complete" fi @@ -302,7 +302,7 @@ if [[ $BLD_PUSH = true ]]; then # Perform release publish in the Docker machine if configuration is present - if [[ $BLD_RELEASE = "true" && -f "release-publish.bash" && publish -eq 1 ]]; then + if [[ $BLD_RELEASE = "true" && -x "release-publish.bash" && publish -eq 1 ]]; then msg "${BLUE}===${NOFORMAT} Publishing release package for $BLD_RELEASE_VERSION" mkdir -p publish if [[ -f "release.env" ]]; then @@ -311,6 +311,7 @@ if [[ $BLD_PUSH = true ]]; then --entrypoint "/app/release-publish.bash" \ --env-file release.env \ -e BLD_RELEASE_VERSION="$BLD_RELEASE_VERSION" \ + -v "${PWD}/:/app" \ -v "${PWD}/package:/package" \ "$BLD_FULL_DOCKER_IMAGE" else @@ -318,6 +319,7 @@ if [[ $BLD_PUSH = true ]]; then --rm \ --entrypoint "/app/release-publish.bash" \ -e BLD_RELEASE_VERSION="$BLD_RELEASE_VERSION" \ + -v "${PWD}/:/app" \ -v "${PWD}/package:/package" \ "$BLD_FULL_DOCKER_IMAGE" fi diff --git a/buildscript.sln b/buildscript.sln index 8460826..be1c867 100644 --- a/buildscript.sln +++ b/buildscript.sln @@ -7,9 +7,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "buildscript", "buildscript\ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3B34BF48-149D-4C8F-B110-575B5194A4AD}" ProjectSection(SolutionItems) = preProject + .gitignore = .gitignore azure-pipelines.yml = azure-pipelines.yml build.bash = build.bash - .github\workflows\build.yml = .github\workflows\build.yml + .github\workflows\ci.yml = .github\workflows\ci.yml Dockerfile = Dockerfile README.md = README.md release-prep.bash = release-prep.bash diff --git a/buildscript/buildscript.csproj b/buildscript/buildscript.csproj index 120e38c..a269962 100644 --- a/buildscript/buildscript.csproj +++ b/buildscript/buildscript.csproj @@ -2,7 +2,7 @@ Exe - net7.0 + net8.0 diff --git a/release-publish.bash b/release-publish.bash index d2ded57..99acede 100755 --- a/release-publish.bash +++ b/release-publish.bash @@ -81,7 +81,7 @@ zip -q -r9 "buildscript-${BLD_RELEASE_VERSION-}.zip" "${BLD_PUBLISH_DIRECTORY-}" du -sch "${BLD_PUBLISH_DIRECTORY-}"/ "buildscript-${BLD_RELEASE_VERSION-}.zip" -if [[ -n $BLD_RELEASE_TOKEN ]]; then +if [[ -n "${BLD_RELEASE_TOKEN-}" ]]; then curl -L -O https://github.com/tfausak/github-release/releases/latest/download/github-release-linux.gz gunzip github-release-linux.gz && chmod 700 github-release-linux && \ ./github-release-linux upload \