Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.

Commit

Permalink
chore: prepare for archiving
Browse files Browse the repository at this point in the history
Signed-off-by: Tomer Figenblat <[email protected]>
  • Loading branch information
TomerFi committed Sep 26, 2023
1 parent bef27fd commit 3cd2e63
Show file tree
Hide file tree
Showing 6 changed files with 191 additions and 258 deletions.
26 changes: 0 additions & 26 deletions .all-contributorsrc

This file was deleted.

16 changes: 0 additions & 16 deletions .github/stale.yml

This file was deleted.

178 changes: 89 additions & 89 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,89 +1,89 @@
---
name: Deploy

on:
workflow_dispatch:

jobs:
deploy:
runs-on: ubuntu-latest
environment: deployment
name: Build and deploy
steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
ssh-key: ${{ secrets.DEPLOY_KEY }}

- name: Install node 16
uses: actions/setup-node@v3
with:
node-version: '16'
cache: npm

- name: Configure git
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
- name: Configure aws
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}

- name: Bump patch version
id: bumper
run: |
newVersion=$(npm version patch --no-git-tag-version | sed 's/v//g')
echo "new_version=$newVersion" >> $GITHUB_OUTPUT
- name: Install project modules
run: npm ci --production

- name: Create lambda archive
run: zip -r github-management-scripts.zip src/ node_modules/

- name: Get function state
id: function_state
run: |
state=$(aws lambda get-function --function-name ${{ secrets.LAMBDA_FUNCTION }} --query 'Configuration.State' --output text)
echo "state=$state" >> $GITHUB_OUTPUT
- name: Verify function is in active state
if: steps.function_state.outputs.state != 'Active'
uses: actions/github-script@v6
with:
script: core.setFailed('the function is being updated, please try again later')

- name: Deploy archive to lambda
run: >
aws lambda update-function-code
--function-name ${{ secrets.LAMBDA_FUNCTION }}
--zip-file fileb://./github-management-scripts.zip
- name: Wait for function to be updated
run: aws lambda wait function-updated --function-name ${{ secrets.LAMBDA_FUNCTION }}

- name: Publish lambda function
id: publish_lambda
run: |
set -o pipefail
function_version=$(aws lambda publish-version --function-name ${{ secrets.LAMBDA_FUNCTION }} | jq -r ".Version")
echo "function_version=$function_version" >> $GITHUB_OUTPUT
- name: Update alias Live with new function version
run: >
aws lambda update-alias
--function-name ${{ secrets.LAMBDA_FUNCTION }}
--name Live
--function-version ${{ steps.publish_lambda.outputs.function_version }}
- name: Push and tag package modifications
run: |
git add package.json
git add package-lock.json
git commit -m "chore: updated package with ${{ steps.bumper.outputs.new_version }} [skip ci]"
git tag ${{ steps.bumper.outputs.new_version }} -m "Function v${{ steps.publish_lambda.outputs.function_version }}"
git push --follow-tags
#---
#name: Deploy
#
#on:
# workflow_dispatch:
#
#jobs:
# deploy:
# runs-on: ubuntu-latest
# environment: deployment
# name: Build and deploy
# steps:
# - name: Checkout sources
# uses: actions/checkout@v3
# with:
# ssh-key: ${{ secrets.DEPLOY_KEY }}
#
# - name: Install node 16
# uses: actions/setup-node@v3
# with:
# node-version: '16'
# cache: npm
#
# - name: Configure git
# run: |
# git config user.name "${{ github.actor }}"
# git config user.email "${{ github.actor }}@users.noreply.github.com"
#
# - name: Configure aws
# uses: aws-actions/configure-aws-credentials@v2
# with:
# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
# aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# aws-region: ${{ secrets.AWS_REGION }}
#
# - name: Bump patch version
# id: bumper
# run: |
# newVersion=$(npm version patch --no-git-tag-version | sed 's/v//g')
# echo "new_version=$newVersion" >> $GITHUB_OUTPUT
#
# - name: Install project modules
# run: npm ci --production
#
# - name: Create lambda archive
# run: zip -r github-management-scripts.zip src/ node_modules/
#
# - name: Get function state
# id: function_state
# run: |
# state=$(aws lambda get-function --function-name ${{ secrets.LAMBDA_FUNCTION }} --query 'Configuration.State' --output text)
# echo "state=$state" >> $GITHUB_OUTPUT
#
# - name: Verify function is in active state
# if: steps.function_state.outputs.state != 'Active'
# uses: actions/github-script@v6
# with:
# script: core.setFailed('the function is being updated, please try again later')
#
# - name: Deploy archive to lambda
# run: >
# aws lambda update-function-code
# --function-name ${{ secrets.LAMBDA_FUNCTION }}
# --zip-file fileb://./github-management-scripts.zip
#
# - name: Wait for function to be updated
# run: aws lambda wait function-updated --function-name ${{ secrets.LAMBDA_FUNCTION }}
#
# - name: Publish lambda function
# id: publish_lambda
# run: |
# set -o pipefail
# function_version=$(aws lambda publish-version --function-name ${{ secrets.LAMBDA_FUNCTION }} | jq -r ".Version")
# echo "function_version=$function_version" >> $GITHUB_OUTPUT
#
# - name: Update alias Live with new function version
# run: >
# aws lambda update-alias
# --function-name ${{ secrets.LAMBDA_FUNCTION }}
# --name Live
# --function-version ${{ steps.publish_lambda.outputs.function_version }}
#
# - name: Push and tag package modifications
# run: |
# git add package.json
# git add package-lock.json
# git commit -m "chore: updated package with ${{ steps.bumper.outputs.new_version }} [skip ci]"
# git tag ${{ steps.bumper.outputs.new_version }} -m "Function v${{ steps.publish_lambda.outputs.function_version }}"
# git push --follow-tags
62 changes: 31 additions & 31 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
---
name: Pull request build

on:
pull_request:
branches:
- main

jobs:
lint:
runs-on: ubuntu-latest
name: Lint project
permissions:
checks: write
contents: read
pull-requests: write
steps:
- name: Checkout sources
uses: actions/checkout@v3

- name: Install node 16
uses: actions/setup-node@v3
with:
node-version: '16'
cache: npm

- name: Install project modules
run: npm ci

- name: Lint source files
run: npm run lint
#---
#name: Pull request build
#
#on:
# pull_request:
# branches:
# - main
#
#jobs:
# lint:
# runs-on: ubuntu-latest
# name: Lint project
# permissions:
# checks: write
# contents: read
# pull-requests: write
# steps:
# - name: Checkout sources
# uses: actions/checkout@v3
#
# - name: Install node 16
# uses: actions/setup-node@v3
# with:
# node-version: '16'
# cache: npm
#
# - name: Install project modules
# run: npm ci
#
# - name: Lint source files
# run: npm run lint
Loading

0 comments on commit 3cd2e63

Please sign in to comment.