diff --git a/.github/workflows/deploy-scancode.yml b/.github/workflows/deploy-scancode.yml new file mode 100644 index 0000000..a2057b8 --- /dev/null +++ b/.github/workflows/deploy-scancode.yml @@ -0,0 +1,45 @@ +name: Create and publish scancode image + +on: + push: + tags: + - "scancode-toolkit/v*" +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }}/scancode-toolkit + +jobs: + build-and-push-image: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + repository: nexB/scancode-toolkit + + - name: Log in to the Container registry + uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@05d22bf31770de02e20c67c70365453e00227f61 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=match,pattern=scancode-toolkit/v(\d+\.\d+\.\d+),group=1 + + - name: Build and push Docker image + uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 + with: + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} +