Last active
April 14, 2023 08:41
-
-
Save EmaLinuxawy/b7fc8a6516125bfcd9c14a160e72f0e6 to your computer and use it in GitHub Desktop.
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
#@ load("@ytt:data", "data") | |
#@ load("@ytt:template", "template") | |
#@ def build(env): | |
build-deploy: | |
name: #@ "Build and Deploy Services" + env.name | |
needs: #@ env.name | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
service: ${{ fromJson(needs.service-names.outputs.services) }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install skaffold | |
run: | | |
curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/latest/skaffold-linux-amd64 && \ | |
sudo install skaffold /usr/local/bin/ | |
skaffold version | |
- name: Install aws-iam-authenticator | |
run: | | |
curl -o aws-iam-authenticator https://amazon-eks.s3.us-west-2.amazonaws.com/1.18.8/2020-09-18/bin/linux/amd64/aws-iam-authenticator && \ | |
chmod +x ./aws-iam-authenticator && \ | |
sudo cp ./aws-iam-authenticator /usr/local/bin/aws-iam-authenticator | |
aws-iam-authenticator version | |
- 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: us-east-1 | |
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }} | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
with: | |
registries: 1234567890 | |
- name: Build Images | |
working-directory: ${{ format('./{0}/dev', matrix.service) }} | |
run: | | |
echo "Building images for service $SERVICE" | |
skaffold build ... --file-output=./images.json | |
env: | |
SERVICE: ${{ matrix.service }} | |
- uses: EndBug/add-and-commit@v5 | |
with: | |
message: ${{ format('[ga-deploy] update dev images for {0}', matrix.service) }} | |
add: ${{ format('./{0}/dev/images.json', matrix.service) }} | |
cwd: "." | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Deploy Images Dev | |
working-directory: ${{ format('./{0}/dev', matrix.service) }} | |
run: | | |
echo "Deploying service $SERVICE" | |
skaffold deploy ... --build-artifacts=./images.json | |
env: | |
SERVICE: ${{ matrix.service }} | |
#@ end | |
#@ if/end "build_deploy" in data.values: | |
_: #@ template.replace(build(data.values.build_deploy)) |
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
#@data/values | |
--- | |
build_deploy: | |
name: application-test |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment