Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/add static web workflows #2

Open
wants to merge 45 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 43 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
8c1163c
adding static web in s3 workflows templates
steplixleandro Feb 10, 2023
d1ac623
change reference to reposiory
steplixleandro Feb 10, 2023
22765d4
refactor pipes
steplixleandro Feb 15, 2023
e4b5cd7
refactor finish
steplixleandro Feb 15, 2023
a554c9d
fix references problems
steplixleandro Apr 18, 2023
bd3b9c1
testing
steplixleandro Apr 21, 2023
a878d9d
debuggin
steplixleandro Apr 21, 2023
20f6e37
prueba
steplixleandro Apr 21, 2023
d844773
debug
steplixleandro Apr 21, 2023
e6fb8d4
Fix reference problem
steplixleandro Apr 21, 2023
1492f14
fix bug
steplixleandro Apr 21, 2023
679d740
fix bug
steplixleandro Apr 21, 2023
739c174
push
steplixleandro Apr 21, 2023
3fa4e95
fix
steplixleandro Apr 21, 2023
aef5c39
test
steplixleandro Apr 24, 2023
f808468
fix event
steplixleandro Apr 25, 2023
5932001
adding package publish pipes
fGrennon Feb 15, 2023
fc62393
adding templates for publish npm
fGrennon Feb 15, 2023
5e8fae9
fixing publish npm
fGrennon Feb 15, 2023
fe3d069
fix update package.json in publish npm
fGrennon Feb 15, 2023
1e72360
fix publish npm flow
fGrennon Feb 15, 2023
ebf3487
fix publish npm flow
fGrennon Feb 15, 2023
52bf159
fix tag in publish npm flow
fGrennon Feb 15, 2023
d924dbb
bitbucket scripts
snobili-steplix Apr 10, 2023
caa078a
final bb pipeline
snobili-steplix Apr 10, 2023
2f519b7
Adding react native mobile pipelines
fGrennon Apr 20, 2023
91ce0e4
adding static web in s3 workflows templates
steplixleandro Feb 10, 2023
21313d0
change reference to reposiory
steplixleandro Feb 10, 2023
3fee2ec
refactor pipes
steplixleandro Feb 15, 2023
ee756f9
refactor finish
steplixleandro Feb 15, 2023
885ad4b
fix references problems
steplixleandro Apr 18, 2023
9684bd2
testing
steplixleandro Apr 21, 2023
0ee90e6
debuggin
steplixleandro Apr 21, 2023
fc339de
prueba
steplixleandro Apr 21, 2023
a9c202e
debug
steplixleandro Apr 21, 2023
7c01799
Fix reference problem
steplixleandro Apr 21, 2023
cf5bfe8
fix bug
steplixleandro Apr 21, 2023
9a32bfe
fix bug
steplixleandro Apr 21, 2023
004854f
push
steplixleandro Apr 21, 2023
a46fc34
fix
steplixleandro Apr 21, 2023
5907f15
test
steplixleandro Apr 24, 2023
68e3f47
fix event
steplixleandro Apr 25, 2023
91f20d8
Merge branch 'feature/addStaticWebWorkflows' of github.com:steplix/ci…
steplixleandro Apr 25, 2023
98b3cb7
changes
steplixleandro Apr 28, 2023
d79a0f3
notify on error
steplixleandro Jul 25, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions .github/workflows/web-s3-develop-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Push in development branch
run-name: >
"Create PR FROM develop TO ${{ inputs.DESTINATION_PR_ON_DEVELOP_WORKFLOW }}: ${{ github.event.head_commit.message }}"

on:
workflow_call:
inputs:
NODE_VERSION:
description: 'Node version to use'
type: string
default: 14.18.0
required: false
DESTINATION_PR:
description: 'Branch to target MR'
type: string
default: testing
required: false
PR_TITLE:
type: string
description: "Title for the pr"
default: "Pushing develop"
required: false
SLACK_CHANNEL:
type: string
description: Slack channel to send notifications
required: false
secrets:
SLACK_WEBHOOK_URL:
required: true

jobs:

testing:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ inputs.NODE_VERSION }}
- run: npm ci
- run: npm run lint --if-present
- run: npm run test --if-present
- run: echo "TEST SUCCESSFULLY"

build:
needs: [ testing ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ inputs.NODE_VERSION }}
- run: npm ci
- run: npm run release


generate-pr:
needs: [ build ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: generate-pr
id: open-pr
uses: repo-sync/pull-request@v2
with:
destination_branch: ${{ inputs.DESTINATION_PR }}
pr_title: ${{ inputs.PR_TITLE }}
- run: echo "PR GENERATED SUCCESSFULLY"

notify:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No notificaria errores en develop

if: ${{ always() }}
needs: [testing, build, generate-pr]
runs-on: ubuntu-latest
steps:
- name: Notify Slack
uses: steplix/[email protected]
with:
template: 'push'
status: ${{ needs.testing.result || needs.build.result || needs.generate-pr.result }}
slack_webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }}
channel: ${{ inputs.SLACK_CHANNEL }}
92 changes: 92 additions & 0 deletions .github/workflows/web-s3-hotfix-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: Push Hotfix in master branch
run-name: >
Push: ${{ github.ref_name }}

on:
workflow_call:
inputs:
NODE_VERSION:
description: 'Node version to use'
type: string
default: 14.18.0
required: false
DESTINATION_PR_MASTER:
description: 'Branch to target MR'
type: string
default: master
required: false
DESTINATION_PR_DEVELOP:
description: 'Branch to target MR'
type: string
default: develop
required: false
SLACK_CHANNEL:
type: string
description: Slack channel to send notifications
required: false
secrets:
SLACK_WEBHOOK_URL:
required: true

jobs:

testing:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ inputs.NODE_VERSION }}
- run: npm ci
- run: npm run lint --if-present
- run: npm run test --if-present
- run: echo "TEST SUCCESSFULLY"

build:
needs: [ testing ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ inputs.NODE_VERSION }}
- run: npm ci
- run: npm run release

generate-pr-to-master:
needs: [testing,build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: generate-pr
id: open-pr
uses: repo-sync/pull-request@v2
with:
destination_branch: ${{ inputs.DESTINATION_PR_MASTER }}
pr_title: "<patch> is TAG VERSION INCREMENT: Pushing HOTFIX ${{ github.ref_name }} into ${{ inputs.DESTINATION_PR_MASTER }}"
- run: echo "PR GENERATED SUCCESSFULLY"

generate-pr-to-develop:
needs: [testing,build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: generate-pr
id: open-pr
uses: repo-sync/pull-request@v2
with:
destination_branch: ${{ inputs.DESTINATION_PR_DEVELOP }}
pr-title: "Pushing HOTFIX ${{ github.ref_name }} into ${{ inputs.DESTINATION_PR_DEVELOP }}"

notify:
if: ${{ always() }}
needs: [ testing,build,generate-pr-to-master,generate-pr-to-develop ]
runs-on: ubuntu-latest
steps:
- name: Notify Slack
uses: steplix/[email protected]
with:
template: 'push'
status: ${{ needs.testing.result || needs.build.result || needs.generate-pr-to-master.result || needs.generate-pr-to-develop.result }}
slack_webhook_url: ${{ secrets.SLACK_WEBHOOK }}
channel: ${{ inputs.SLACK_CHANNEL }}
99 changes: 99 additions & 0 deletions .github/workflows/web-s3-master-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: Push in master branch
run-name: >
${{ github.event.pull_request.title }}

on:
workflow_call:
inputs:
NODE_VERSION:
description: 'Node version to use'
type: string
default: 14.18.0
required: false
SLACK_CHANNEL:
type: string
description: Slack channel to send notifications
required: false
AWS_BUCKET:
type: string
description: Bucket S3 to copy files for deploy
required: true
TEXT-WHERE-SEARCH-FOR-PARAMETERS:
type: string
description: 'Message to parse. Defaults to head commit message'
required: false
default: ${{ github.event.head_commit.message }}
secrets:
SLACK_WEBHOOK_URL:
required: true
AWS_KEY_ID:
required: true
AWS_SECRET_ACCESS_KEY:
required: true
AWS_REGION:
required: true


jobs:

tagging:
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.bumped_tag.outputs.version }}
steps:
- uses: steplix/[email protected]
id: args
with:
message: ${{ inputs.TEXT-WHERE-SEARCH-FOR-PARAMETERS}}
param-0: major
param-1: minor

- name: Get bumping mode
id: bump-mode
run: echo "mode=${{ (steps.args.outputs.param-0 == 'true' && 'major') || (steps.args.outputs.param-1 == 'true' && 'minor') || 'patch' }}" >> $GITHUB_OUTPUT

# Bump tag without affecting repository
- uses: zwaldowski/semver-release-action@v3
name: Get bumped tag
id: bumped_tag
with:
bump: ${{ steps.bump-mode.outputs.mode }}
github_token: ${{ secrets.GITHUB_TOKEN }}

build-zip-upload:
needs: [ tagging ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ inputs.NODE_VERSION }}
- run: npm ci
- run: npm run release
#ZIP
- name: generate-zip
id: zip
run: cd out && tar -czvf ${{ needs.tagging.outputs.tag }}.tar.gz *

#UPLOAD
- uses: aws-actions/[email protected]
with:
aws-access-key-id: ${{ secrets.AWS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: copy files to S3
run: |
aws s3 cp out/${{ needs.tagging.outputs.tag }}.tar.gz s3://${{ inputs.AWS_BUCKET }}/${{ needs.tagging.outputs.tag }}.tar.gz


notify:
if: ${{ always() }}
needs: [ tagging,build-zip-upload ]
runs-on: ubuntu-latest
steps:
- name: Notify Slack
uses: steplix/[email protected]
with:
template: 'push'
status: ${{ needs.tagging.result || needs.build-zip-upload.result }}
slack_webhook_url: ${{ secrets.SLACK_WEBHOOK }}
81 changes: 81 additions & 0 deletions .github/workflows/web-s3-release-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Deployment to production
run-name: >
Production deployment ${{ github.event.release.tag_name }}: ${{ github.event.release.name }}

on:
workflow_call:
inputs:
SLACK_CHANNEL:
type: string
description: Slack channel to send notifications
required: false
AWS_BUCKET:
type: string
description: Bucket S3 to copy files for deploy
required: true
AWS_BUCKET_ARTIFACT:
type: string
description: Bucket S3 to download artifact to deploy
required: true
AWS_CLOUDFRONT_DISTRIBUTION_ID:
type: string
description: CloudFront Distribution ID
required: true
secrets:
SLACK_WEBHOOK_URL:
required: true
AWS_KEY_ID:
required: true
AWS_SECRET_ACCESS_KEY:
required: true
AWS_REGION:
required: true

jobs:

## DEPLOY

download_unzip_deploy:
runs-on: ubuntu-latest
steps:
#DOWNLOAD
- uses: aws-actions/[email protected]
with:
aws-access-key-id: ${{ secrets.AWS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}

- name: download zip from S3
run: |
aws s3 cp s3://${{ inputs.AWS_BUCKET_ARTIFACT }}/${{ github.event.release.tag_name }}.tar.gz .
#UNZIP
- name: mkdir
run: mkdir output

- name: un-zip
id: unzip
run: tar -xvzf ${{ github.event.release.tag_name }}.tar.gz -C output

#UPLOAD

- name: copy files to S3
run: |
aws s3 sync output s3://${{ inputs.AWS_BUCKET }}
- name: Cloudfront invalidation
run: |
aws cloudfront create-invalidation --distribution-id ${{ inputs.AWS_CLOUDFRONT_DISTRIBUTION_ID }} --paths "/*"



notify:
if: ${{ always() }}
needs: [ download_unzip_deploy ]
runs-on: ubuntu-latest
steps:
- name: Notify Slack
uses: steplix/[email protected]
with:
template: 'push'
status: ${{ needs.download_unzip_deploy.result}}
slack_webhook_url: ${{ secrets.SLACK_WEBHOOK }}
channel: ${{ inputs.SLACK_CHANNEL }}
Loading