A clean, Markdown-based publishing platform made for writers. Write together, and build a community. https://writefreely.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

62 lines
1.7 KiB

  1. name: Build container image, publish as Github-package
  2. # This workflow uses actions that are not certified by GitHub.
  3. # They are provided by a third-party and are governed by
  4. # separate terms of service, privacy policy, and support
  5. # documentation.
  6. on:
  7. push:
  8. branches: [ main, develop ]
  9. # Publish semver tags as releases.
  10. tags:
  11. - 'v*.*.*'
  12. env:
  13. # Use docker.io for Docker Hub if empty
  14. REGISTRY: ghcr.io
  15. # github.repository as <account>/<repo>
  16. IMAGE_NAME: ${{ github.repository }}
  17. jobs:
  18. build:
  19. runs-on: ubuntu-latest
  20. permissions:
  21. contents: read
  22. packages: write
  23. steps:
  24. - name: Checkout repository
  25. uses: actions/checkout@v3
  26. # Login against a Docker registry except on PR
  27. # https://github.com/docker/login-action
  28. - name: Log into registry ${{ env.REGISTRY }}
  29. if: github.event_name != 'pull_request'
  30. uses: docker/login-action@v2.0.0
  31. with:
  32. registry: ${{ env.REGISTRY }}
  33. username: ${{ github.actor }}
  34. password: ${{ secrets.GITHUB_TOKEN }}
  35. # Extract metadata (tags, labels) for Docker
  36. # https://github.com/docker/metadata-action
  37. - name: Extract Docker metadata
  38. id: meta
  39. uses: docker/metadata-action@v4.0.1
  40. with:
  41. images: |
  42. ghcr.io/${{ github.repository }}
  43. flavor: latest=true
  44. # Build and push Docker image with Buildx (don't push on PR)
  45. # https://github.com/docker/build-push-action
  46. - name: Build and push Docker images
  47. uses: docker/build-push-action@v3.0.0
  48. with:
  49. context: .
  50. push: ${{ github.event_name != 'pull_request' }}
  51. tags: ${{ steps.meta.outputs.tags }}
  52. labels: ${{ steps.meta.outputs.labels }}