-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #87 from trueberryless-org/release-image-gen
add dotnet support and rig
- Loading branch information
Showing
6 changed files
with
408 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"template-files": patch | ||
--- | ||
|
||
Add DotNet Support: Release Image Generator |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json", | ||
"changelog": [ | ||
"@changesets/changelog-github", | ||
{ "repo": "trueberryless-org/<%= repositoryName %>" } | ||
], | ||
"commit": false, | ||
"fixed": [], | ||
"linked": [], | ||
"access": "public", | ||
"baseBranch": "main", | ||
"updateInternalDependencies": "patch", | ||
"ignore": [], | ||
"privatePackages": { | ||
"version": true, | ||
"tag": true | ||
} | ||
} |
170 changes: 170 additions & 0 deletions
170
template-files/.github/workflows/deployment-dotnet.yaml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,170 @@ | ||
name: Deployment | ||
|
||
on: | ||
push: | ||
branches: [<%= branchName %>] | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request_target' && github.head_ref || github.ref }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
REGISTRY: docker.io | ||
IMAGE_OWNER: trueberryless | ||
IMAGE_NAME: <%= repositoryName %> | ||
NODE_VERSION: 20 | ||
|
||
jobs: | ||
changesets: | ||
name: Changesets | ||
runs-on: ubuntu-latest | ||
outputs: | ||
hasChangesets: ${{ steps.changesets.outputs.hasChangesets }} | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
steps: | ||
- name: Generate GitHub App token | ||
id: generate_token | ||
uses: tibdex/[email protected] | ||
with: | ||
app_id: ${{ secrets.BOT_APP_ID }} | ||
private_key: ${{ secrets.BOT_PRIVATE_KEY }} | ||
|
||
- name: Checkout Repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup PNPM | ||
uses: pnpm/action-setup@v3 | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ env.NODE_VERSION }} | ||
cache: "pnpm" | ||
|
||
- name: Install Dependencies | ||
run: pnpm i | ||
|
||
- name: Create Release Pull Request | ||
id: changesets | ||
uses: changesets/action@v1 | ||
with: | ||
commit: "[ci] release" | ||
title: "[ci] release" | ||
env: | ||
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
||
image-tag: | ||
name: Image Tag | ||
runs-on: ubuntu-latest | ||
outputs: | ||
IMAGE_TAG: ${{ env.IMAGE_TAG }} | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Read version from package.json | ||
id: get_version | ||
run: | | ||
VERSION=$(jq -r '.version' <%= projectFolder %>/package.json) | ||
echo "IMAGE_TAG=$VERSION" >> $GITHUB_ENV | ||
deployment: | ||
needs: [changesets, image-tag] | ||
if: > | ||
( | ||
needs.changesets.outputs.hasChangesets == 'false' && | ||
( | ||
contains(github.event.head_commit.message, 'deploy') || | ||
contains(github.event.head_commit.message, '[ci] release') | ||
) | ||
) || | ||
github.event_name == 'workflow_dispatch' | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Log in to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }} | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: ./<%= projectFolder %> | ||
push: true | ||
tags: | | ||
${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:${{ needs.image-tag.outputs.IMAGE_TAG }} | ||
${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:latest | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
||
- name: Update deployment.yaml file | ||
run: | | ||
yq eval '.spec.template.spec.containers[0].image = "${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:${{ needs.image-tag.outputs.IMAGE_TAG }}"' -i manifest/deployment.yaml | ||
- uses: stefanzweifel/git-auto-commit-action@v4 | ||
with: | ||
commit_message: update deployment.json container image (automated) | ||
|
||
release: | ||
name: Release | ||
needs: [image-tag, deployment] | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v4 | ||
|
||
- id: extract-changelog | ||
uses: sean0x42/[email protected] | ||
with: | ||
file: <%= projectFolder %>/CHANGELOG.md | ||
pattern: ${{ needs.image-tag.outputs.IMAGE_TAG }} | ||
|
||
- uses: ncipollo/release-action@v1 | ||
id: create_release | ||
with: | ||
tag: ${{ env.IMAGE_NAME }}@${{ needs.image-tag.outputs.IMAGE_TAG }} | ||
makeLatest: <%= makeLatest %> | ||
body: ${{ steps.extract-changelog.outputs.markdown }} | ||
skipIfReleaseExists: true | ||
|
||
- name: Check if release was created | ||
id: check_release | ||
run: | | ||
if [ -z "${{ steps.create_release.outputs.html_url }}" ]; then | ||
echo "RELEASE_SKIPPED=true" >> $GITHUB_ENV | ||
else | ||
echo "RELEASE_SKIPPED=false" >> $GITHUB_ENV | ||
fi | ||
- name: Discord notification | ||
if: env.RELEASE_SKIPPED == 'false' | ||
env: | ||
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_URL }} | ||
uses: Ilshidur/[email protected] | ||
with: | ||
args: | | ||
# ${{ env.IMAGE_NAME }}@${{ needs.image-tag.outputs.IMAGE_TAG }} | ||
${{ steps.extract-changelog.outputs.markdown }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
*.swp | ||
*.*~ | ||
project.lock.json | ||
.DS_Store | ||
*.pyc | ||
nupkg/ | ||
|
||
# Visual Studio Code | ||
.vscode | ||
|
||
# Rider | ||
.idea | ||
|
||
# User-specific files | ||
*.suo | ||
*.user | ||
*.userosscache | ||
*.sln.docstates | ||
|
||
# Build results | ||
[Dd]ebug/ | ||
[Dd]ebugPublic/ | ||
[Rr]elease/ | ||
[Rr]eleases/ | ||
x64/ | ||
x86/ | ||
build/ | ||
bld/ | ||
[Bb]in/ | ||
[Oo]bj/ | ||
[Oo]ut/ | ||
msbuild.log | ||
msbuild.err | ||
msbuild.wrn | ||
|
||
# Visual Studio 2015 | ||
.vs/ |
Oops, something went wrong.