Skip to content

Commit

Permalink
Update main.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
bo-lu authored May 30, 2024
1 parent 230b090 commit 4221958
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,26 @@ on:
workflow_dispatch:

jobs:
set-timestamp:
runs-on: ubuntu-latest
outputs:
timestamp: ${{ steps.get-timestamp.outputs.timestamp }}
steps:
- name: Get current timestamp
id: get-timestamp
run: echo "::set-output name=timestamp::$(date -u +'%Y%m%d-%H%M')"

build-and-upload-artifact:
runs-on: ubuntu-latest
needs: set-timestamp
env:
TIMESTAMP: ${{ needs.set-timestamp.outputs.timestamp }}
PYGEOAPI_CONFIG: "$(pwd)/pygeoapi-config.yml"
strategy:
matrix:
node-version: [20.x]
include:
- python-version: '3.10'
env:
PYGEOAPI_CONFIG: "$(pwd)/pygeoapi-config.yml"
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

steps:
- name: Clear up GitHub runner diskspace
run: |
Expand Down Expand Up @@ -70,9 +78,6 @@ jobs:
# args: -c "serverless plugin install --name serverless-python-requirements && serverless plugin install --name serverless-wsgi && serverless package && serverless deploy"
entrypoint: /bin/sh

- name: Set current date as env variable
run: echo "NOW=$(date +'%Y%m%d-%H%M')" >> $GITHUB_ENV

- name: Post packaging steps necessary to prevent a twice zipped deployment file
run: |
mkdir temp
Expand All @@ -81,12 +86,15 @@ jobs:
- name: Upload zip file artifact
uses: actions/upload-artifact@v4
with:
name: cgp_pygeoapi-${{ env.NOW }}
name: cgp_pygeoapi-${{ ${{ env.TIMESTAMP }} }}
path: ${{ github.workspace }}/temp

copy-artifact-to-dev-branch:
runs-on: ubuntu-latest
needs: build-and-upload-artifact
needs: [set-timestamp, build-and-upload-artifact]

env:
TIMESTAMP: ${{ needs.set-timestamp.outputs.timestamp }}

steps:
- name: Checkout repository
Expand All @@ -95,7 +103,7 @@ jobs:
- name: Download zipped artifact
uses: actions/download-artifact@v4
with:
name: cgp_pygeoapi-${{ env.NOW }}
name: cgp_pygeoapi-${{ env.TIMESTAMP }}
path: ${{ github.workspace }}/temp

- name: Create new dev branch and overwrite artifact with force push
Expand Down

0 comments on commit 4221958

Please sign in to comment.