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:
|
||||
branches:
|
||||
- main
|
||||
- 'feature/serverless-*' # Build development images for serverless features
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
@@ -17,10 +16,12 @@ env:
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
if: >-
|
||||
github.event_name != 'push'
|
||||
|| !contains(github.event.head_commit.message, '[skip ci]')
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
id-token: write
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
@@ -55,50 +56,6 @@ jobs:
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
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-to: type=gha,mode=max
|
||||
platforms: linux/amd64
|
||||
|
||||
@@ -16,7 +16,9 @@ env:
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.ref == 'refs/heads/main'
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
|
||||
@@ -100,7 +100,8 @@ jobs:
|
||||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.tag }}
|
||||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.version }}
|
||||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
||||
no-cache: true
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
platforms: linux/amd64
|
||||
|
||||
- name: Publish Helm Chart to GitHub Pages
|
||||
@@ -157,31 +158,35 @@ jobs:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
# 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
|
||||
COMMITS=$(git log --pretty=format:"- %s (%h)" HEAD)
|
||||
else
|
||||
COMMITS=$(git log --pretty=format:"- %s (%h)" "${PREV_TAG}..HEAD")
|
||||
fi
|
||||
|
||||
cat > release-notes.md <<EOF
|
||||
## Release ${{ steps.version.outputs.version }}
|
||||
cat > release-notes.md <<'NOTESEOF'
|
||||
## Release RELEASE_VERSION
|
||||
|
||||
### Changes
|
||||
${COMMITS}
|
||||
RELEASE_COMMITS
|
||||
|
||||
### Docker Image
|
||||
\`\`\`bash
|
||||
docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.tag }}
|
||||
\`\`\`
|
||||
```bash
|
||||
docker pull RELEASE_IMAGE
|
||||
```
|
||||
|
||||
### Helm Chart
|
||||
\`\`\`bash
|
||||
```bash
|
||||
helm repo add devcontainer https://cpfarhood.github.io/devcontainer
|
||||
helm repo update
|
||||
helm install mydev devcontainer/devcontainer --version ${{ steps.version.outputs.version }} --set name=mydev
|
||||
\`\`\`
|
||||
EOF
|
||||
helm install mydev devcontainer/devcontainer --version RELEASE_VERSION --set name=mydev
|
||||
```
|
||||
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 }}" \
|
||||
--title "Release ${{ steps.version.outputs.tag }}" \
|
||||
|
||||
Reference in New Issue
Block a user