Feat #160
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Dev CI/CD | |
on: | |
push: | |
branches: | |
- ci | |
pull_request: | |
types: [closed] | |
workflow_dispatch: # Allow manual execution | |
jobs: | |
build: | |
runs-on: ubuntu-latest # (3). OS environment | |
if: | | |
(github.event_name == 'pull_request' && github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'develop') || | |
(github.event_name == 'push' && github.event.ref == 'refs/heads/ci') | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 # (4). Code checkout | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 # (5). Java setup | |
with: | |
java-version: '17' | |
distribution: 'adopt' | |
- name: Grant execute permission for gradlew and build with Gradle | |
run: | | |
chmod +x ./gradlew | |
./gradlew clean build -x test | |
shell: bash # (7). Build script | |
- name: Login to Docker Hub | |
run: | | |
docker login -u euegenechoi -p ${{ secrets.DOCKER_PASSWORD }} | |
docker build -t euegenechoi/careerfestival . | |
docker push euegenechoi/careerfestival | |
- name: Get current time | |
uses: 1466587594/get-current-time@v2 | |
id: current-time | |
with: | |
format: YYYY-MM-DDTHH-mm-ss | |
utcOffset: "+09:00" # (8). Time in your time zone | |
- name: Show current time | |
run: echo "CurrentTime=$" | |
shell: bash # (9). Show build time | |
- name: Deploy to Elastic Beanstalk with Beanstalk Deploy action | |
uses: einaregilsson/beanstalk-deploy@v20 | |
with: | |
aws_access_key: ${{ secrets.AWS_ACTION_ACCESS_KEY_ID }} | |
aws_secret_key: ${{ secrets.AWS_ACTION_SECRET_ACCESS_KEY }} | |
application_name: careerfestival-dev | |
environment_name: Careerfestival-dev-env | |
version_label: github-action-${{ steps.current-time.outputs.formattedTime }} | |
region: ap-northeast-2 | |
deployment_package: Dockerrun.aws.json # Change to this after creating the file | |
wait_for_deployment: false | |