-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (77 loc) · 2.51 KB
/
pr.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
name: Test & Build
on:
pull_request:
branches:
- main
workflow_dispatch:
defaults:
run:
shell: bash
jobs:
generate-tags:
name: Generate tags
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: "0"
- name: Extract branch name
id: extract_branch
run: |
if [ "$GITHUB_EVENT_NAME" == "push" ]; then
echo BRANCH_NAME=main >> $GITHUB_ENV
else
branch=${{ github.head_ref }}
branch=${branch//-}
branch=${branch//_}
branch=${branch//\/}
echo BRANCH_NAME=${branch} >> $GITHUB_ENV
fi
- name: Bump version
id: bump_version
uses: anothrNick/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
INITIAL_VERSION: 0.0.0
DEFAULT_BUMP: minor
PRERELEASE: true
PRERELEASE_SUFFIX: ${{ env.BRANCH_NAME }}
RELEASE_BRANCHES: main
WITH_V: true
outputs:
docker_tag: ${{ steps.bump_version.outputs.tag }}
generate-environment-workspace-name:
runs-on: ubuntu-latest
steps:
- name: Generate workspace name
id: name_workspace
run: |
workspace=${{ github.event.number }}${{ github.head_ref }}
workspace=${workspace//-}
workspace=${workspace//_}
workspace=${workspace//\/}
workspace=${workspace:0:11}
workspace=$(echo ${workspace} | tr '[:upper:]' '[:lower:]')
echo "name=${workspace}" >> $GITHUB_OUTPUT
echo ${workspace}
outputs:
environment_workspace_name: ${{ steps.name_workspace.outputs.name }}
build:
name: Build, Scan & Push Images
needs: [generate-tags]
uses: ./.github/workflows/partials/build-push-images.yml
with:
docker_tag: ${{ needs.generate-tags.outputs.docker_tag }}
secrets:
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# deploy-pr-env:
# name: Deploy PR Environment
# needs: [build, generate-environment-workspace-name]
# uses: ./.github/workflows/partials/deploy.yml
# with:
# workspace_name: ${{ needs.generate-environment-workspace-name.outputs.environment_workspace_name }}
# version_tag: ${{ needs.generate-tags.outputs.docker_tag }}
# secrets:
# aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
# aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}