Skip to content

Commit

Permalink
Use github ref and new variable outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
VikingTristan committed Feb 2, 2021
1 parent ff36ca3 commit f7e43bf
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 31 deletions.
25 changes: 6 additions & 19 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,18 @@ 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
run: ./.github/scripts/sentry.sh
env:
TOKEN: ${{ secrets.SENTRY_TOKEN }}

- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '5.3.x'

- name: Use GitVersion
id: gitversion
uses: gittools/actions/gitversion/[email protected]

- name: Set Node.js 12.x
uses: actions/setup-node@master
with:
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -111,4 +98,4 @@ jobs:
asset_path: ${{ steps.zip.outputs.zipfile }}
asset_name: ${{ steps.zip.outputs.zipfile }}
asset_content_type: application/zip

12 changes: 5 additions & 7 deletions .github/workflows/janitor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }}
az storage blob delete-batch -s "\$web" --pattern ${{ steps.branch.outputs.BRANCH_TO_DELETE }}/** --account-name ${{ steps.variables.outputs.AZURE_ACCOUNT }}
6 changes: 2 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Main
on:
on:
push:
branches:
- "feature/**"
Expand All @@ -14,8 +14,6 @@ jobs:
brand: ["payex", "swedbankpay"]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

# Set brand specific variables
- name: Environment variables
Expand Down Expand Up @@ -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 }}
az storage blob upload-batch -s dist -d \$web --account-name ${{ steps.variables.outputs.AZURE_ACCOUNT }}
2 changes: 1 addition & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
pattern: "{dist/**/*.js,dist/**/*.css}"

0 comments on commit f7e43bf

Please sign in to comment.