From 392c5172b3a5200721718303a9fa362adccbb493 Mon Sep 17 00:00:00 2001 From: Matthew Casperson Date: Wed, 26 Oct 2022 05:53:43 +1000 Subject: [PATCH] Update php.yaml --- .github/workflows/php.yaml | 65 +++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 33 deletions(-) diff --git a/.github/workflows/php.yaml b/.github/workflows/php.yaml index 9a29e89..3b08419 100644 --- a/.github/workflows/php.yaml +++ b/.github/workflows/php.yaml @@ -1,5 +1,8 @@ # The following workflow provides an opinionated template you can customize for your own needs. # +# If you are not an Octopus user, the "Push to Octopus", "Generate Octopus Deploy build information", +# and "Create Octopus Release" steps can be safely deleted. +# # To configure Octopus, set the OCTOPUS_API_TOKEN secret to the Octopus API key, and # set the OCTOPUS_SERVER_URL secret to the Octopus URL. # @@ -8,28 +11,28 @@ # # Get a trial Octopus instance from https://octopus.com/start +name: PHP Build +'on': + workflow_dispatch: {} + push: {} jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v3 with: fetch-depth: '0' - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: 3.x - name: Install GitVersion - uses: gittools/actions/gitversion/setup@v0.9.7 + uses: gittools/actions/gitversion/setup@v0.9.14 with: versionSpec: 5.x - id: determine_version name: Determine Version - uses: gittools/actions/gitversion/execute@v0.9.7 + uses: gittools/actions/gitversion/execute@v0.9.14 with: additionalArguments: /overrideconfig mode=Mainline - name: Install Octopus Deploy CLI - uses: OctopusDeploy/install-octocli@v1.1.1 + uses: OctopusDeploy/install-octopus-cli-action@v1 with: version: latest - name: Install Dependencies @@ -52,7 +55,7 @@ jobs: name: Dependencies Updates path: dependencyUpdates.txt - name: Test - run: vendor/bin/phpunit --log-junit results.xml tests || true + run: vendor/bin/phpunit --log-junit results.xml tests shell: bash - if: always() name: Report @@ -95,51 +98,47 @@ jobs: with: custom_tag: ${{ steps.determine_version.outputs.semVer }} github_token: ${{ secrets.GITHUB_TOKEN }} - - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - id: create_release + - id: create_release name: Create Release uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag_name: ${{ steps.determine_version.outputs.semVer }}+run${{ github.run_number }}-attempt${{ github.run_attempt }} release_name: Release ${{ steps.determine_version.outputs.semVer }} Run ${{ github.run_number }} Attempt ${{ github.run_attempt }} draft: 'false' prerelease: 'false' - - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Upload Release Asset + - 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: RandomQuotes-PHP.${{ steps.determine_version.outputs.semVer }}.zip asset_name: RandomQuotes-PHP.${{ steps.determine_version.outputs.semVer }}.zip asset_content_type: application/octet-stream - - name: Push to Octopus - uses: OctopusDeploy/push-package-action@v1.1.1 + - name: Push packages to Octopus Deploy + uses: OctopusDeploy/push-package-action@v2 + env: + OCTOPUS_API_KEY: ${{ secrets.OCTOPUS_API_TOKEN }} + OCTOPUS_HOST: ${{ secrets.OCTOPUS_SERVER_URL }} with: - api_key: ${{ secrets.OCTOPUS_API_TOKEN }} packages: RandomQuotes-PHP.${{ steps.determine_version.outputs.semVer }}.zip - server: ${{ secrets.OCTOPUS_SERVER_URL }} overwrite_mode: OverwriteExisting - name: Generate Octopus Deploy build information - uses: xo-energy/action-octopus-build-information@v1.1.2 + uses: OctopusDeploy/push-build-information-action@v1 + env: + OCTOPUS_API_KEY: ${{ secrets.OCTOPUS_API_TOKEN }} + OCTOPUS_HOST: ${{ secrets.OCTOPUS_SERVER_URL }} with: - octopus_api_key: ${{ secrets.OCTOPUS_API_TOKEN }} - octopus_project: RandomQuotes-PHP - octopus_server: ${{ secrets.OCTOPUS_SERVER_URL }} - push_version: ${{ steps.determine_version.outputs.semVer }} - push_package_ids: RandomQuotes-PHP - push_overwrite_mode: OverwriteExisting - output_path: octopus + version: ${{ steps.determine_version.outputs.semVer }} + packages: RandomQuotes-PHP + overwrite_mode: OverwriteExisting - name: Create Octopus Release - uses: OctopusDeploy/create-release-action@v1.1.1 + uses: OctopusDeploy/create-release-action@v1 with: api_key: ${{ secrets.OCTOPUS_API_TOKEN }} project: RandomQuotes-PHP server: ${{ secrets.OCTOPUS_SERVER_URL }} - deploy_to: Dev + deploy_to: Development packages: RandomQuotes-PHP:${{ steps.determine_version.outputs.semVer }} -name: PHP Build -'on': - workflow_dispatch: {} - push: {}