diff --git a/.github/workflows/deploy-module.yml b/.github/workflows/deploy-module.yml index 0fe8b7da..6716045a 100644 --- a/.github/workflows/deploy-module.yml +++ b/.github/workflows/deploy-module.yml @@ -36,7 +36,7 @@ jobs: with: ref: ${{ github.head_ref }} # checkout the correct branch name fetch-depth: 0 - token: ${{ secrets.REPO_TOKEN }} + token: ${{ secrets.GITHUB_TOKEN }} - name: Install GitVersion uses: gittools/actions/gitversion/setup@v0.9.15 with: @@ -68,7 +68,7 @@ jobs: with: ref: ${{ github.head_ref }} # checkout the correct branch name fetch-depth: 0 - token: ${{ secrets.REPO_TOKEN }} + token: ${{ secrets.GITHUB_TOKEN }} - name: Download Build Artifact uses: actions/download-artifact@v4 with: @@ -83,8 +83,8 @@ jobs: - name: Merge main -> develop # This step merges the main branch into the develop branch after a successful deployment. This ensures that the develop branch includes the tag for the latest release. run: | - git config --local user.email "jpomfret7@gmail.com" - git config --local user.name "Automated Jess Did this" + git config --local user.email "bot@github.com" + git config --local user.name "GitHub Bot" git checkout main git pull git checkout develop diff --git a/.github/workflows/publish-module.yml b/.github/workflows/publish-module.yml new file mode 100644 index 00000000..d6c03db8 --- /dev/null +++ b/.github/workflows/publish-module.yml @@ -0,0 +1,69 @@ +on: + push: + branches: + - main + paths-ignore: + - CHANGELOG.md + - .vscode/** + - .github/** + - images/** + - tests/** + - '**.md' + - '**.yml' + tags: + - '*' +env: + buildFolderName: output + buildArtifactName: output + +permissions: + actions: write # to allow the workflow to run actions + checks: write # to allow the workflow to create checks + statuses: write # to allow the workflow to create statuses + +name: Deploy Module (only) +# This workflow is triggered on push to the main branch and deploys the module to the PowerShell Gallery and creates a GitHub Release. +jobs: + Build_Stage_Package_Module: + name: Package Module + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v3 + with: + ref: ${{ github.head_ref }} # checkout the triggered ref (branch or tag) + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} + - name: Build & Package Module + shell: pwsh + run: ./build.ps1 -ResolveDependency -tasks pack + - name: Publish Build Artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ env.buildArtifactName }} + path: ${{ env.buildFolderName }}/ + + Deploy_Stage_Deploy_Module: + name: Deploy Module + runs-on: ubuntu-latest + needs: + - Build_Stage_Package_Module + if: ${{ success() && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) }} + steps: + - name: Checkout Code + uses: actions/checkout@v3 + with: + ref: ${{ github.head_ref }} # checkout the triggered ref (branch or tag) + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} + - name: Download Build Artifact + uses: actions/download-artifact@v4 + with: + name: ${{ env.buildArtifactName }} + path: ${{ env.buildFolderName }} + - name: Publish Release + shell: pwsh + run: ./build.ps1 -tasks publish + env: + GitHubToken: ${{ secrets.GitHubToken }} + GalleryApiToken: ${{ secrets.GalleryApiToken }} diff --git a/source/FabricTools.psd1 b/source/FabricTools.psd1 index 18c0ce6b..3efd2a9a 100644 --- a/source/FabricTools.psd1 +++ b/source/FabricTools.psd1 @@ -12,7 +12,7 @@ RootModule = 'FabricTools.psm1' # Version number of this module. -ModuleVersion = '0.0.1' +ModuleVersion = '0.31.0' # Supported PSEditions # CompatiblePSEditions = @()