fix: clean up GitHub Actions workflows
- Enable GHA build cache across all workflows (replace no-cache: true) - Add [skip ci] guard to build-and-push to prevent duplicate latest builds during releases - Remove dead serverless branch trigger and build-routing-proxy job - Remove unused id-token: write permission - Add branch guard and contents: read permission to quick-fix workflow - Fix release notes heredoc indentation so markdown renders correctly - Fix git describe to use HEAD~1 for accurate changelog after version bump Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -4,7 +4,6 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
- 'feature/serverless-*' # Build development images for serverless features
|
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
@@ -17,10 +16,12 @@ env:
|
|||||||
jobs:
|
jobs:
|
||||||
build-and-push:
|
build-and-push:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
if: >-
|
||||||
|
github.event_name != 'push'
|
||||||
|
|| !contains(github.event.head_commit.message, '[skip ci]')
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
packages: write
|
packages: write
|
||||||
id-token: write
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
@@ -55,50 +56,6 @@ jobs:
|
|||||||
push: ${{ github.event_name != 'pull_request' }}
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
no-cache: true
|
|
||||||
platforms: linux/amd64
|
|
||||||
|
|
||||||
# Build routing proxy image for serverless features
|
|
||||||
build-routing-proxy:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
# Only build routing proxy for serverless feature branches
|
|
||||||
if: github.ref == 'refs/heads/feature/serverless-2.0.0' && github.event_name != 'pull_request'
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
packages: write
|
|
||||||
id-token: write
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v6
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
|
|
||||||
- name: Log in to GitHub Container Registry
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: ${{ env.REGISTRY }}
|
|
||||||
username: ${{ github.actor }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Extract metadata for routing proxy
|
|
||||||
id: meta-proxy
|
|
||||||
uses: docker/metadata-action@v5
|
|
||||||
with:
|
|
||||||
images: ${{ env.REGISTRY }}/cpfarhood/devcontainer-routing-proxy
|
|
||||||
tags: |
|
|
||||||
type=raw,value=latest
|
|
||||||
type=raw,value=2.0.0-dev
|
|
||||||
type=sha,prefix=sha-
|
|
||||||
|
|
||||||
- name: Build and push routing proxy image
|
|
||||||
uses: docker/build-push-action@v6
|
|
||||||
with:
|
|
||||||
context: ./serverless/routing-proxy
|
|
||||||
push: true
|
|
||||||
tags: ${{ steps.meta-proxy.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta-proxy.outputs.labels }}
|
|
||||||
cache-from: type=gha
|
cache-from: type=gha
|
||||||
cache-to: type=gha,mode=max
|
cache-to: type=gha,mode=max
|
||||||
platforms: linux/amd64
|
platforms: linux/amd64
|
||||||
|
|||||||
@@ -16,7 +16,9 @@ env:
|
|||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
if: github.ref == 'refs/heads/main'
|
||||||
permissions:
|
permissions:
|
||||||
|
contents: read
|
||||||
packages: write
|
packages: write
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|||||||
@@ -100,7 +100,8 @@ jobs:
|
|||||||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.tag }}
|
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.tag }}
|
||||||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.version }}
|
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.version }}
|
||||||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
||||||
no-cache: true
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
||||||
platforms: linux/amd64
|
platforms: linux/amd64
|
||||||
|
|
||||||
- name: Publish Helm Chart to GitHub Pages
|
- name: Publish Helm Chart to GitHub Pages
|
||||||
@@ -157,31 +158,35 @@ jobs:
|
|||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
# Build release notes
|
# Build release notes
|
||||||
PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
|
PREV_TAG=$(git describe --tags --abbrev=0 HEAD~1 2>/dev/null || echo "")
|
||||||
if [ -z "$PREV_TAG" ]; then
|
if [ -z "$PREV_TAG" ]; then
|
||||||
COMMITS=$(git log --pretty=format:"- %s (%h)" HEAD)
|
COMMITS=$(git log --pretty=format:"- %s (%h)" HEAD)
|
||||||
else
|
else
|
||||||
COMMITS=$(git log --pretty=format:"- %s (%h)" "${PREV_TAG}..HEAD")
|
COMMITS=$(git log --pretty=format:"- %s (%h)" "${PREV_TAG}..HEAD")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cat > release-notes.md <<EOF
|
cat > release-notes.md <<'NOTESEOF'
|
||||||
## Release ${{ steps.version.outputs.version }}
|
## Release RELEASE_VERSION
|
||||||
|
|
||||||
### Changes
|
### Changes
|
||||||
${COMMITS}
|
RELEASE_COMMITS
|
||||||
|
|
||||||
### Docker Image
|
### Docker Image
|
||||||
\`\`\`bash
|
```bash
|
||||||
docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.tag }}
|
docker pull RELEASE_IMAGE
|
||||||
\`\`\`
|
```
|
||||||
|
|
||||||
### Helm Chart
|
### Helm Chart
|
||||||
\`\`\`bash
|
```bash
|
||||||
helm repo add devcontainer https://cpfarhood.github.io/devcontainer
|
helm repo add devcontainer https://cpfarhood.github.io/devcontainer
|
||||||
helm repo update
|
helm repo update
|
||||||
helm install mydev devcontainer/devcontainer --version ${{ steps.version.outputs.version }} --set name=mydev
|
helm install mydev devcontainer/devcontainer --version RELEASE_VERSION --set name=mydev
|
||||||
\`\`\`
|
```
|
||||||
EOF
|
NOTESEOF
|
||||||
|
sed -i 's/^ //' release-notes.md
|
||||||
|
sed -i "s|RELEASE_VERSION|${{ steps.version.outputs.version }}|g" release-notes.md
|
||||||
|
sed -i "s|RELEASE_IMAGE|${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.tag }}|g" release-notes.md
|
||||||
|
sed -i "s|RELEASE_COMMITS|${COMMITS}|g" release-notes.md
|
||||||
|
|
||||||
gh release create "${{ steps.version.outputs.tag }}" \
|
gh release create "${{ steps.version.outputs.tag }}" \
|
||||||
--title "Release ${{ steps.version.outputs.tag }}" \
|
--title "Release ${{ steps.version.outputs.tag }}" \
|
||||||
|
|||||||
Reference in New Issue
Block a user