fix: ghr publish (#1346) #186
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: Stencil CLI Release | |
| on: | |
| push: | |
| branches: [master, main] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write # to be able to publish a GitHub release | |
| issues: write # to be able to comment on released issues | |
| pull-requests: write # to be able to comment on released pull requests | |
| id-token: write # to enable use of OIDC for trusted publishing and npm provenance | |
| packages: write # docker images publishing to github container registry | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22.x' | |
| - name: Update npm | |
| run: npm install -g npm@latest | |
| - run: npm i | |
| - name: Check Git Commit name | |
| run: git log -1 --pretty=format:"%s" | npx commitlint | |
| - name: Deploy to npm and git | |
| run: npm config list && npm run release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| GA_USERNAME: ${{ secrets.PAT_USERNAME }} | |
| GA_TOKEN: ${{ secrets.PAT_TOKEN }} | |
| - name: Get latest Git tag | |
| id: tag | |
| run: | | |
| git fetch --tags | |
| TAG=$(git describe --tags --abbrev=0) | |
| echo "tag=$TAG" >> $GITHUB_OUTPUT | |
| - name: Log in to the Github Container registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata (tags, labels) for Docker | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ghcr.io/${{ github.repository_owner }}/stencil-cli | |
| tags: | | |
| type=semver,pattern={{version}},prefix=,value=${{ steps.tag.outputs.tag }} | |
| type=semver,pattern={{major}},prefix=,value=${{ steps.tag.outputs.tag }} | |
| type=semver,pattern={{major}}.{{minor}},prefix=,value=${{ steps.tag.outputs.tag }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build and push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} |