Skip to content

Commit

Permalink
add deployment to pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
Laurent LE LARDEUX committed Jan 6, 2023
1 parent cd72a64 commit b4a8ca0
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 10 deletions.
6 changes: 0 additions & 6 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@ name: Deploy

on:
workflow_dispatch:
push:
branches:
- 'main'
paths-ignore:
- '.github/**/*.yml'
- '.gitignore'

jobs:

Expand Down
40 changes: 38 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: build-${{ steps.get-version.outputs.VERSION }}
path: target/build-${{ steps.get-version.outputs.VERSION }}.war
path: |
target/build.war
scripts/
appspec.yml
release-project:
name: Release
Expand All @@ -90,4 +93,37 @@ jobs:
artifactErrorsFailBuild: true
artifacts: build-${{ needs.build-project.outputs.VERSION }}.zip
artifactContentType: application/zip
skipIfReleaseExists: true
skipIfReleaseExists: true

deploy-project:
name: Deploy
runs-on: ubuntu-latest
needs: release-project

steps:

- name: Download latest release asset
id: download-release-asset
uses: robinraju/release-downloader@v1.7
with:
latest: true
fileName: "*.zip"

- name: Rename artefact
run: mv build-${{ steps.download-release-asset.outputs.tag_name }}.zip build.zip

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
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: Deploy asset to AWS s3
run: |
aws s3 rm s3://${{ secrets.AWS_S3_BUCKET }}/ --recursive
aws s3 cp build.zip s3://${{ secrets.AWS_S3_BUCKET }} --recursive
- name: Launch AWS codedeploy deployment
run : |
aws deploy create-deployment --application-name poc-inetum --deployment-config-name CodeDeployDefault.OneAtATime --deployment-group-name HelloWorldDeploymentGroup --s3-location bucket=poc-devops-backend,bundleType=zip,key=build.zip
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</parent>
<groupId>com.example</groupId>
<artifactId>build</artifactId>
<version>0.0.2</version>
<version>0.0.3</version>
<packaging>war</packaging>
<name>laurent</name>
<description>laurent</description>
Expand Down Expand Up @@ -38,7 +38,7 @@
</dependencies>

<build>
<!--finalName></finalName-->
<finalName>build</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down

0 comments on commit b4a8ca0

Please sign in to comment.