-
Notifications
You must be signed in to change notification settings - Fork 1
Add automated release workflow with Docker publishing #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
14c5ce2
Initial plan
Copilot 7af0045
Add GitHub Actions release workflow with Docker publishing
Copilot 316192f
Update README with pre-built Docker image instructions
Copilot 5f5fd40
Document release process in CONTRIBUTING.md
Copilot ed5b43d
Fix latest tag condition in release workflow
Copilot 49eafee
Make tarball creation more robust and fix Docker Hub latest tag
Copilot 5d4a474
Clarify latest tagging behavior in documentation
Copilot b6cfee1
Remove major version tagging and add build verification
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,138 @@ | ||
| name: Release | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - 'v*' # Trigger on version tags like v1.0.0, v0.1.0, etc. | ||
|
|
||
| env: | ||
| REGISTRY: ghcr.io | ||
| IMAGE_NAME: ${{ github.repository }} | ||
|
|
||
| jobs: | ||
| build-and-release: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| packages: write | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '22.x' | ||
| cache: 'npm' | ||
|
|
||
| - name: Install dependencies | ||
| run: npm ci | ||
|
|
||
| - name: Run tests | ||
| run: npm test | ||
|
|
||
| - name: Build TypeScript | ||
| run: npm run build | ||
|
|
||
| - name: Verify build output | ||
| run: | | ||
| if [ ! -d "dist" ]; then | ||
| echo "Error: dist directory not found after build" | ||
| exit 1 | ||
| fi | ||
| echo "Build successful, dist directory contains:" | ||
| ls -la dist/ | ||
|
|
||
| - name: Create build artifact | ||
| run: | | ||
| mkdir -p release-artifacts | ||
| tar -czf release-artifacts/odette-${{ github.ref_name }}.tar.gz \ | ||
| dist/ \ | ||
| views/ \ | ||
| public/ \ | ||
| package.json \ | ||
| package-lock.json \ | ||
| README.md \ | ||
| LICENSE.txt | ||
|
|
||
| - 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 Docker | ||
| id: meta | ||
| uses: docker/metadata-action@v5 | ||
| with: | ||
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
| tags: | | ||
| type=semver,pattern={{version}} | ||
| type=semver,pattern={{major}}.{{minor}} | ||
| type=raw,value=latest,enable=${{ !contains(github.ref_name, '-') }} | ||
|
|
||
| - name: Build and push Docker image | ||
| uses: docker/build-push-action@v5 | ||
| with: | ||
| context: . | ||
| push: true | ||
| tags: ${{ steps.meta.outputs.tags }} | ||
| labels: ${{ steps.meta.outputs.labels }} | ||
| cache-from: type=gha | ||
| cache-to: type=gha,mode=max | ||
| platforms: linux/amd64,linux/arm64 | ||
|
|
||
| - name: Create GitHub Release | ||
| uses: softprops/action-gh-release@v1 | ||
| with: | ||
| files: release-artifacts/* | ||
| generate_release_notes: true | ||
| draft: false | ||
| prerelease: ${{ contains(github.ref_name, '-') }} | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| # Optional: Publish to Docker Hub | ||
| # Uncomment this job and add DOCKERHUB_USERNAME and DOCKERHUB_TOKEN secrets | ||
| # docker-hub: | ||
| # runs-on: ubuntu-latest | ||
| # needs: build-and-release | ||
| # if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | ||
| # | ||
| # steps: | ||
| # - name: Checkout code | ||
| # uses: actions/checkout@v4 | ||
| # | ||
| # - 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.DOCKERHUB_USERNAME }} | ||
| # password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
| # | ||
| # - name: Extract metadata for Docker | ||
| # id: meta | ||
| # uses: docker/metadata-action@v5 | ||
| # with: | ||
| # images: ${{ secrets.DOCKERHUB_USERNAME }}/odette | ||
| # tags: | | ||
| # type=semver,pattern={{version}} | ||
| # type=semver,pattern={{major}}.{{minor}} | ||
| # type=raw,value=latest,enable=${{ !contains(github.ref_name, '-') }} | ||
| # | ||
| # - name: Build and push to Docker Hub | ||
| # uses: docker/build-push-action@v5 | ||
| # with: | ||
| # context: . | ||
| # push: true | ||
| # tags: ${{ steps.meta.outputs.tags }} | ||
| # labels: ${{ steps.meta.outputs.labels }} | ||
| # cache-from: type=gha | ||
| # platforms: linux/amd64,linux/arm64 | ||
This file contains hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.