From f7e43bf7dd4a061c3063e8184886bd7cc7774c9d Mon Sep 17 00:00:00 2001 From: Thomas Lorntzen Date: Thu, 15 Oct 2020 10:10:07 +0200 Subject: [PATCH] Use github ref and new variable outputs --- .github/workflows/create-release.yml | 25 ++++++------------------- .github/workflows/janitor.yml | 12 +++++------- .github/workflows/main.yml | 6 ++---- .github/workflows/pull-request.yml | 2 +- 4 files changed, 14 insertions(+), 31 deletions(-) diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 5a36692b51..ba36babf60 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -13,15 +13,11 @@ jobs: brand: ["payex", "swedbankpay"] steps: - uses: actions/checkout@v2 - with: - fetch-depth: 0 # Set brand specific variables - name: Environment variables id: variables - run: ./.github/scripts/variables.sh - env: - BRAND: ${{ matrix.brand }} + run: ./.github/scripts/variables.sh --brand ${{ matrix.brand }} --ref ${{ github.ref }} # Add sentry token - name: Sentry token @@ -29,15 +25,6 @@ jobs: env: TOKEN: ${{ secrets.SENTRY_TOKEN }} - - name: Install GitVersion - uses: gittools/actions/gitversion/setup@v0.9.4 - with: - versionSpec: '5.3.x' - - - name: Use GitVersion - id: gitversion - uses: gittools/actions/gitversion/execute@v0.9.4 - - name: Set Node.js 12.x uses: actions/setup-node@master with: @@ -57,13 +44,13 @@ jobs: run: npm run lint && npm run test:codecov - name: Build - run: npm run ${{ steps.variables.outputs.BUILD_SCRIPT }} -- --env.release=true --env.baseUrl="${{ steps.variables.outputs.BRAND_URL }}" --env.basename="v/${{ steps.gitversion.outputs.majorMinorPatch }}" --env.semver=${{ steps.gitversion.outputs.semVer }} --env.info_version=${{ steps.gitversion.outputs.informationalVersion }} --env.github_actions=true + run: npm run ${{ steps.variables.outputs.BUILD_SCRIPT }} -- --env.release=true --env.baseUrl="${{ steps.variables.outputs.BRAND_URL }}" --env.basename="v/${{ steps.variables.outputs.VERSION }}" --env.semver=${{ steps.variables.outputs.VERSION }} --env.github_actions=true - name: Zip Release id: zip env: BRAND: ${{ steps.variables.outputs.BRAND_NAME }} - run: | + run: | ZIPFILE=${BRAND}-DesignGuide.zip echo "Zipping ${ZIPFILE}" zip -r ${ZIPFILE} dist @@ -85,7 +72,7 @@ jobs: with: inlineScript: | az storage blob upload-batch -s dist -d \$web --account-name ${{ steps.variables.outputs.AZURE_ACCOUNT }} - + - name: Create Release id: create_release # Only create a release on one brand to avoid duplicate error @@ -95,7 +82,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag_name: ${{ github.ref }} - release_name: Design Guide v${{ steps.gitversion.outputs.majorMinorPatch }} + release_name: Design Guide v${{ steps.variables.outputs.VERSION }} body_path: RELEASE-NOTES.md draft: false prerelease: false @@ -111,4 +98,4 @@ jobs: asset_path: ${{ steps.zip.outputs.zipfile }} asset_name: ${{ steps.zip.outputs.zipfile }} asset_content_type: application/zip - + diff --git a/.github/workflows/janitor.yml b/.github/workflows/janitor.yml index bb7a384a76..da0b78b520 100644 --- a/.github/workflows/janitor.yml +++ b/.github/workflows/janitor.yml @@ -16,9 +16,9 @@ jobs: with: fetch-depth: 2 - - name: Dump GitHub context + - name: Dump GitHub context env: - GITHUB_CONTEXT: ${{ toJson(github) }} + GITHUB_CONTEXT: ${{ toJson(github) }} run: echo "$GITHUB_CONTEXT" - name: Check if commit is merge commit @@ -29,19 +29,17 @@ jobs: - name: Environment variables if: ${{ steps.branch.outputs.BRANCH_TO_DELETE }} id: variables - run: ./.github/scripts/variables.sh - env: - BRAND: ${{ matrix.brand }} + run: ./.github/scripts/variables.sh --brand ${{ matrix.brand }} --ref ${{ github.ref }} - name: Azure Login if: ${{ steps.branch.outputs.BRANCH_TO_DELETE }} uses: azure/login@v1 with: creds: ${{ secrets.AZURE_CREDENTIALS }} - + - name: Delete feature folders if: ${{ steps.branch.outputs.BRANCH_TO_DELETE }} uses: azure/CLI@v1 with: inlineScript: | - az storage blob delete-batch -s "\$web" --pattern ${{ steps.branch.outputs.BRANCH_TO_DELETE }}/** --account-name ${{ steps.variables.outputs.AZURE_ACCOUNT }} \ No newline at end of file + az storage blob delete-batch -s "\$web" --pattern ${{ steps.branch.outputs.BRANCH_TO_DELETE }}/** --account-name ${{ steps.variables.outputs.AZURE_ACCOUNT }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 82930f7dc1..725112c2b4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,5 +1,5 @@ name: Main -on: +on: push: branches: - "feature/**" @@ -14,8 +14,6 @@ jobs: brand: ["payex", "swedbankpay"] steps: - uses: actions/checkout@v2 - with: - fetch-depth: 0 # Set brand specific variables - name: Environment variables @@ -52,4 +50,4 @@ jobs: uses: azure/CLI@v1 with: inlineScript: | - az storage blob upload-batch -s dist -d \$web --account-name ${{ steps.variables.outputs.AZURE_ACCOUNT }} \ No newline at end of file + az storage blob upload-batch -s dist -d \$web --account-name ${{ steps.variables.outputs.AZURE_ACCOUNT }} diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 2cf8cf5219..6c4b01da97 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -40,4 +40,4 @@ jobs: # basename=PullRequest is added to avoid BundleAnalyzer from holding up the agent [THN] build-script: "${{ steps.variables.outputs.BUILD_SCRIPT }} -- --env.basename=PullRequest" exclude: "{**/*.map,**/node_modules/**,**/*chunk*.*}" - pattern: "{dist/**/*.js,dist/**/*.css}" \ No newline at end of file + pattern: "{dist/**/*.js,dist/**/*.css}"