fix: github registry authentication error #5
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
| name: Lint, build and publish | |
| on: | |
| push: | |
| branches: | |
| - '**' | |
| - '!crowdin' | |
| tags: | |
| - '*' | |
| pull_request_target: | |
| branches: | |
| - '*' | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| checks: write | |
| steps: | |
| - name: Checkout your repository using git | |
| uses: actions/checkout@v4 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 18 | |
| cache: npm | |
| - name: Install Node Dependencies | |
| run: | | |
| npm install | |
| - name: Run linters | |
| uses: wearerequired/lint-action@v2 | |
| with: | |
| eslint: true | |
| eslint_extensions: ts,vue | |
| eslint_args: --ignore-path .gitignore | |
| push_to_registry: | |
| runs-on: ubuntu-latest | |
| needs: lint | |
| outputs: | |
| tags: ${{ steps.save_tags.outputs.tags }} | |
| steps: | |
| - | |
| name: Checkout | |
| uses: actions/checkout@v4 | |
| - | |
| name: Docker meta | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| # list of Docker images to use as base name for tags | |
| images: | | |
| vncommunityleague/vnoc | |
| # generate Docker tags based on the following events/attributes | |
| # on push event: tag using git sha, branch name and as latest (if master) | |
| tags: | | |
| type=raw,value=latest,enable=${{ github.ref_type == 'branch' && github.ref_name == 'master' }} | |
| type=raw,value=${{ github.ref_name }} | |
| type=raw,value=${{ github.sha }},enable=${{ github.ref_type == 'branch' }} | |
| flavor: | | |
| latest=false | |
| - | |
| name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - | |
| name: Login to GitHub Container registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.CR_PAT }} | |
| - | |
| name: Build and push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: ./Dockerfile | |
| platforms: linux/amd64 | |
| push: ${{ github.repository == 'vncommunityleague/vnoc' && github.event_name != 'pull_request_target' }} | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| - | |
| name: Save tags | |
| id: save_tags | |
| run: echo "tags=$(echo '${{ steps.meta.outputs.tags }}' | cut -d ':' -f 2- | jq -Rsc '. / "\n" - [""]')" >> $GITHUB_OUTPUT | |
| # push_chart: | |
| # if: ${{ github.repository == 'vncommunityleague/vnoc' && github.event_name != 'pull_request_target' }} | |
| # runs-on: ubuntu-latest | |
| # needs: push_to_registry | |
| # strategy: | |
| # matrix: | |
| # tag: ${{ fromJSON(needs.push_to_registry.outputs.tags) }} | |
| # exclude: | |
| # - tag: latest | |
| # steps: | |
| # - | |
| # name: Checkout | |
| # uses: actions/checkout@v2 | |
| # - | |
| # name: "Helm: Package Chart" | |
| # run: helm package charts/vnoc --version "0.0.0-${{ matrix.tag }}" --app-version "${{ matrix.tag }}" | |
| # - | |
| # name: "Helm: Login to Registry" | |
| # run: echo '${{ secrets.GITHUB_TOKEN }}' | helm registry login -u '${{ github.actor }}' --password-stdin ghcr.io | |
| # - | |
| # name: "Helm: Push Chart" | |
| # run: helm push vnoc-0.0.0-${{ matrix.tag }}.tgz oci://ghcr.io/vnoc/charts | |
| # - | |
| # name: "Helm: Logout" | |
| # run: helm registry logout ghcr.io | |