0.5.3 #19
Workflow file for this run
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: Build Docker Image | |
on: | |
release: | |
types: [published] | |
jobs: | |
ImageBuild: | |
name: Build Code-Server-Operator Custom Docker Image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Slack notification of build start | |
uses: rtCamp/action-slack-notify@v2 | |
env: | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} | |
SLACK_USERNAME: GitHub Actions | |
SLACK_COLOR: "#4381de" | |
SLACK_ICON: "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" | |
SLACK_TITLE: Start Code-Server-Operator image build | |
SLACK_MESSAGE: | | |
Run number : #${{ github.run_number }} | |
- name: Check out | |
uses: actions/checkout@v4 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: walnuts1018 | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
version: latest | |
- name: Get Tag from Release | |
run: echo "ImageTag=${GITHUB_REF##*/}" >> $GITHUB_ENV | |
- name: Build and push Docker images | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
context: . | |
platforms: linux/amd64 | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
build-args: TARGETARCH=amd64,TARGETOS=linux | |
tags: | | |
ghcr.io/walnuts1018/code-server-operator:latest | |
ghcr.io/walnuts1018/code-server-operator:${{ github.event.release.tag_name }} | |
chart-release: | |
runs-on: ubuntu-latest | |
needs: ImageBuild | |
if: ${{ success() }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set chart version | |
run: | | |
sed --in-place "s/version-placeholder/${{ github.event.release.tag_name }}/g" charts/code-server-operator/Chart.yaml | |
sed --in-place "s/version-placeholder/${{ github.event.release.tag_name }}/g" charts/code-server-operator/Chart.yaml | |
sed --in-place "s/latest/${{ github.event.release.tag_name }}/g" charts/code-server-operator/values.yaml | |
sed --in-place "s/repository: controller/repository: ghcr.io\/walnuts1018\/code-server-operator/g" charts/code-server-operator/values.yaml | |
- name: Create release notes | |
run: | | |
# Helm Chart のリリースノートには、本体のリリースへのリンクを追加する | |
tag_version=${GITHUB_REF##*/} | |
cat <<EOF > ./charts/code-server-operator/RELEASE.md | |
Helm chart for Website Operator [$tag_version](https://github.com/walnuts1018/code-server-operator/releases/tag/$tag_version) | |
EOF | |
- name: Configure Git | |
run: | | |
git config user.name "github-actions[bot]" | |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
- name: Install Helm | |
uses: azure/setup-helm@v3 | |
- name: Run chart-releaser | |
uses: helm/[email protected] | |
with: | |
config: cr.yaml | |
env: | |
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
SucceessNotification: | |
if: ${{ success() }} | |
name: Send Success Message | |
needs: [chart-release] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Send Message to Slack | |
uses: rtCamp/action-slack-notify@v2 | |
env: | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} | |
SLACK_USERNAME: GitHub Actions | |
SLACK_ICON: "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" | |
SLACK_TITLE: Code-Server-Operator image build succeeded | |
SLACK_MESSAGE: | | |
Image: Code-Server-Operator | |
Run number : #${{ github.run_number }} | |
FailureAlert: | |
if: ${{ failure() }} | |
name: Notify failure | |
needs: [chart-release] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Send Failure Alert to Slack | |
uses: rtCamp/action-slack-notify@v2 | |
env: | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} | |
SLACK_USERNAME: GitHub Actions | |
SLACK_ICON: "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" | |
SLACK_TITLE: Code-Server-Operator image build failed | |
SLACK_COLOR: danger | |
SLACK_MESSAGE: | | |
Image: Code-Server-Operator | |
Run number : #${{ github.run_number }} |