-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(template): sync with ahmadnassri/template-node-lib
- Loading branch information
Ahmad Nassri
committed
Oct 22, 2021
1 parent
c4bf307
commit df6c0fc
Showing
5 changed files
with
88 additions
and
22 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# ------------------------------------------------------------- # | ||
# Note: this file is automatically managed in template-node-lib # | ||
# ------------------------------------------------------------- # | ||
# ----------------------------------------------- # | ||
# Note: this file originates in template-node-lib # | ||
# ----------------------------------------------- # | ||
|
||
on: | ||
- push | ||
|
@@ -14,12 +14,17 @@ jobs: | |
|
||
outputs: | ||
repository: ${{ steps.metadata.outputs.repository }} | ||
dockerfile: ${{ steps.dockerfile.outputs.exists }} | ||
|
||
steps: | ||
- uses: actions/[email protected] | ||
|
||
- uses: ahmadnassri/action-metadata@v1 | ||
id: metadata | ||
- id: metadata | ||
uses: ahmadnassri/action-metadata@v1 | ||
|
||
- id: dockerfile | ||
run: | | ||
[[ -f "${{ github.workspace }}/Dockerfile" ]] && echo '::set-output name=exists::yes' || exit 0 | ||
commit-lint: | ||
timeout-minutes: 5 | ||
|
@@ -112,10 +117,12 @@ jobs: | |
- run: npm run test:ci | ||
|
||
release: | ||
needs: test-run | ||
needs: | ||
- metadata | ||
- test-run | ||
|
||
# only runs on main branch | ||
if: ${{ github.ref == 'refs/heads/master' }} | ||
# only runs on main branch for non template repos | ||
if: ${{ github.ref == 'refs/heads/master' && !fromJSON(needs.metadata.outputs.repository).is_template }} | ||
|
||
timeout-minutes: 20 | ||
|
||
|
@@ -160,9 +167,70 @@ jobs: | |
- name: publish to github registry | ||
run: | | ||
jq '.name = "@'"${GITHUB_REPOSITORY/node-/}"'"' package.json > /tmp/package.json; mv /tmp/package.json . | ||
npm version --no-git-tag-version v${{ needs.release.outputs.version }} | ||
npm version --no-git-tag-version "v${{ needs.release.outputs.version }}" | ||
npm publish | ||
publish-docker: | ||
needs: | ||
- release | ||
- metadata | ||
|
||
timeout-minutes: 5 | ||
|
||
runs-on: ubuntu-latest | ||
|
||
if: ${{ needs.metadata.outputs.dockerfile == 'yes' }} | ||
|
||
steps: | ||
- uses: actions/[email protected] | ||
with: | ||
submodules: true | ||
|
||
- uses: actions/[email protected] | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: buildx-${{ github.sha }} | ||
restore-keys: buildx- | ||
|
||
- uses: docker/setup-qemu-action@v1 | ||
- uses: docker/setup-buildx-action@v1 | ||
|
||
# login to docker hub | ||
- uses: docker/login-action@v1 | ||
with: | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.DOCKER_TOKEN }} | ||
|
||
# login to github container registry | ||
- uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GH_TOKEN }} | ||
|
||
- id: hub | ||
run: | | ||
echo "::set-output name=name::$(basename "${GITHUB_REPOSITORY/node-//}")" | ||
echo "::set-output name=version::${{ needs.release.outputs.version }}" | ||
# publish | ||
- uses: docker/build-push-action@v2 | ||
with: | ||
push: true | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,dest=/tmp/.buildx-cache | ||
tags: | | ||
${{ github.repository_owner }}/${{ steps.hub.outputs.name }}:latest | ||
${{ github.repository_owner }}/${{ steps.hub.outputs.name }}:${{ steps.hub.outputs.version }} | ||
ghcr.io/${{ github.repository_owner }}/${{ steps.hub.outputs.name }}:latest | ||
ghcr.io/${{ github.repository_owner }}/${{ steps.hub.outputs.name }}:${{ steps.hub.outputs.version }} | ||
labels: | | ||
org.opencontainers.image.title=${{ steps.hub.outputs.name }} | ||
org.opencontainers.image.url=${{ github.event.repository.html_url }} | ||
org.opencontainers.image.version=${{ steps.hub.outputs.version }} | ||
org.opencontainers.image.source=${{ github.event.repository.clone_url }} | ||
org.opencontainers.image.revision=${{ github.sha }} | ||
template-sync: | ||
timeout-minutes: 20 | ||
|
||
|
This file contains 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 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 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 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