Skip to content

Commit

Permalink
gitops-stg for ECS
Browse files Browse the repository at this point in the history
  • Loading branch information
shota-kitazawa committed May 3, 2024
1 parent 03f0643 commit c0a9aaf
Showing 1 changed file with 81 additions and 0 deletions.
81 changes: 81 additions & 0 deletions .github/workflows/gitops-stg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,84 @@ jobs:
pull_number: pr.data.number,
merge_method: "squash",
});
ecs:
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v5

- name: Install jsonnet
run: |
go install github.com/google/go-jsonnet/cmd/jsonnet@latest
go install github.com/google/go-jsonnet/cmd/jsonnetfmt@latest
- name: Generate token
id: generate_token
uses: tibdex/github-app-token@v2
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}

- name: Checkout dreamkast-infra
uses: actions/checkout@v4
with:
repository: cloudnativedaysjp/dreamkast-infra
path: dreamkast-infra
token: ${{ steps.generate_token.outputs.token }}

- name: Update image-tags
working-directory: dreamkast-infra/ecspresso/stg
run: |
cat << _EOL_ | jsonnet - > ./const.libsonnet.tmp
local const = import './const.libsonnet';
const + {
imageTags: const.imageTags + {
dreamkast_weaver: "${{ github.sha }}",
},
}
_EOL_
mv const.libsonnet.tmp const.libsonnet
jsonnetfmt -i const.libsonnet
- name: Commit files
id: commit_files
continue-on-error: true
working-directory: dreamkast-infra/
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git status
git add -A
git commit -am "Bump docker tag (${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/commit/${GITHUB_SHA})"
- name: Push changes
if: steps.commit_files.outcome == 'success'
uses: ad-m/github-push-action@master
with:
github_token: ${{ steps.generate_token.outputs.token }}
repository: cloudnativedaysjp/dreamkast-infra
directory: dreamkast-infra
branch: staging/weaver-main

- name: Create and Merge Pull Request
if: steps.commit_files.outcome == 'success'
uses: "actions/github-script@v7"
with:
github-token: ${{ steps.generate_token.outputs.token }}
script: |
const pr = await github.rest.pulls.create({
owner: "cloudnativedaysjp",
repo: "dreamkast-infra",
title: "Automated PR (staging/weaver-main)",
body: "**this PR is automatically created & merged**",
head: "staging/weaver-main",
base: "main"
});
await github.rest.pulls.merge({
owner: "cloudnativedaysjp",
repo: "dreamkast-infra",
pull_number: pr.data.number,
merge_method: "squash",
});

0 comments on commit c0a9aaf

Please sign in to comment.