-
Notifications
You must be signed in to change notification settings - Fork 1
131 lines (117 loc) · 5.44 KB
/
github-release-action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: Create release
on:
# This workflow will be triggered manually and create a draft release for review. It can be published manually once reviewed.
workflow_dispatch:
inputs:
# You will enter the tag name from the UI while you trigger this pipeline.
tag_name:
description: "Please enter the tag/version you would like to publish:"
required: true
permissions:
issues: write
contents: write
jobs:
release-benefit-finder:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: release
- name: Install Node
uses: actions/setup-node@v4
with:
node-version-file: "./benefit-finder/package.json"
- name: Merging main > release & pushing
env:
GITHUB_TOKEN: "${{ secrets.ADD_TO_PROJECT_PAT }}"
run: |
git fetch --all
git branch --show-current
git config --global user.name "${{ vars.COMMIT_AUTHOR }}"
git config --global user.email "${{ vars.COMMIT_AUTHOR_EMAIL }}"
git merge origin/main --allow-unrelated-histories --strategy-option theirs
git branch --show-current
git status
git push --force-with-lease
- name: Building benefit-finder module
run: bash ./scripts/pipeline/mv-benefit-finder-app.sh
# - name: Install Cloudfoundry CLI
# run: ./scripts/pipeline/deb-cf-install.sh
# - name: Cloud.gov Login
# env:
# CF_USER: "${{ secrets.CF_USER }}"
# CF_PASSWORD: "${{ secrets.CF_PASSWORD }}"
# CF_ORG: "${{ secrets.CF_ORG }}"
# PROJECT: "${{ secrets.PROJECT }}"
# run: source ./scripts/pipeline/cloud-gov-login.sh
# - name: Building & Deploying Storybook App to Dev Env
# env:
# CYPRESS_baseUrl: ${{ vars.CYPRESS_baseUrl }}
# CYPRESS_username: ${{ secrets.BASIC_AUTH_USERNAME }}
# CYPRESS_password: ${{ secrets.BASIC_AUTH_PASSWORD }}
# storybook_username: ${{ secrets.STORYBOOK_USERNAME }}
# storybook_password: ${{ secrets.STORYBOOK_PASSWORD }}
# run: |
# git submodule init
# git submodule update
# mv benefit-finder/manifest.yml benefit-finder/manifest.yml.tpl
# export CIRCLE_BRANCH="dev" # This step makes sure this pipeline can deploy to the dev environment
# envsubst < benefit-finder/manifest.yml.tpl > benefit-finder/manifest.yml
# export NVM_DIR="$HOME/.nvm"
# [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
# [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
# cd benefit-finder
# nvm install node # --reinstall-packages-from=node
# npm i @craco/craco
# npm run build
# bash ../scripts/pipeline/mv-uswds-usagov-theme.sh
# npm run build:storybook
# mv manifest.yml storybook-static/
# mv Staticfile storybook-static/
# mv nginx storybook-static/
# sed -i "s/baseUrl: 'http:\/\/localhost:6006'/baseUrl: '\$CYPRESS_baseUrl'/" cypress.config.js
# mv cypress.config.js cypress.config.js.tpl
# envsubst < cypress.config.js.tpl > cypress.config.js
# cd storybook-static
# echo "${storybook_username}:${storybook_password}" > Staticfile.auth
# cf push benefit-finder-storybook-dev
# - name: Cypres Testing
# env:
# CYPRESS_baseUrl: ${{ vars.CYPRESS_baseUrl }}
# CYPRESS_username: ${{ secrets.BASIC_AUTH_USERNAME }}
# CYPRESS_password: ${{ secrets.BASIC_AUTH_PASSWORD }}
# run: |
# cd benefit-finder
# npm run cy:run
- name: Compressing the module directory
run: |
tar -cvzf "benefit-finder-module-${{ github.event.inputs.tag_name }}.tar.gz" usagov_benefit_finder
ls -l
- name: Checking if the zip file has css and js files expected
run: |
echo "removing usagov_benefit_finder directory.................."
rm -r usagov_benefit_finder
tar -xzvf "benefit-finder-module-${{ github.event.inputs.tag_name }}.tar.gz"
test -d usagov_benefit_finder/modules/usagov_benefit_finder_app/usagov_benefit_finder_page/css || { echo "ERROR!!! There is no css files in the zip file"; }
test -d usagov_benefit_finder/modules/usagov_benefit_finder_app/usagov_benefit_finder_page/js || { echo "ERROR!!! There is no js files in the zip file"; exit 1; }
- name: Setting and pushing Version Tag
run: |
git branch --show-current
TAG_NAME="${{ github.event.inputs.tag_name }}"
git tag $TAG_NAME
git push origin $TAG_NAME
# - name: Close release issues
# run: |
# # Get the list of open issues in the current release/milestone
# issues=$(gh issue list --state open --milestone "${{ github.event.inputs.tag_name }}")
# echo $issues
# # Iterate over each issue and move it to the "Done" column
# for issue in $issues; do
# gh issue $issue close --reason completed
# done
- name: Creating pre-release
env:
GITHUB_TOKEN: "${{ secrets.ADD_TO_PROJECT_PAT }}"
run: |
gh release create "${{ github.event.inputs.tag_name }}" *.tar.gz -t "Release ${{ github.event.inputs.tag_name }}" --target release -d -p --generate-notes