Skip to content

Commit

Permalink
updated CI to be in sync with 'app-skeleton-repo'
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Piskun <[email protected]>
  • Loading branch information
bigcat88 committed Oct 18, 2024
1 parent 07734dc commit 799a653
Show file tree
Hide file tree
Showing 3 changed files with 143 additions and 19 deletions.
52 changes: 45 additions & 7 deletions .github/workflows/publish-docker-cpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,52 @@ jobs:
push_to_registry:
name: Build image
runs-on: ubuntu-22.04
if: ${{ github.repository_owner == 'nextcloud' }} # REPLACE THIS WITH YOUR ORGANIZATION NAME
if: ${{ github.repository_owner == 'nextcloud' }}
permissions:
packages: write
contents: read
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Set app env
run: |
# Split and keep last
echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
echo "APP_VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
with:
path: ${{ env.APP_NAME }}

- name: Read package.json node and npm engines version
uses: skjnldsv/read-package-engines-version-actions@0ce2ed60f6df073a62a77c0a4958dd0fc68e32e7 # v2.1
id: versions
# Continue if no package.json
continue-on-error: true
with:
path: ${{ env.APP_NAME }}
fallbackNode: "^20"
fallbackNpm: "^10"

- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
# Skip if no package.json
if: ${{ steps.versions.outputs.nodeVersion }}
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3
with:
node-version: ${{ steps.versions.outputs.nodeVersion }}

- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
# Skip if no package.json
if: ${{ steps.versions.outputs.npmVersion }}
run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"

- name: Build ${{ env.APP_NAME }}
# Skip if no package.json
if: ${{ steps.versions.outputs.nodeVersion }}
run: |
cd ${{ env.APP_NAME }}
npm ci
npm run build
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
Expand All @@ -35,6 +74,7 @@ jobs:
- name: Extract version from XML
id: extract_version
run: |
cd ${{ env.APP_NAME }}
VERSION=$(xmlstarlet sel -t -v "//image-tag" appinfo/info.xml)
echo "VERSION=$VERSION" >> $GITHUB_ENV
Expand All @@ -45,11 +85,9 @@ jobs:
- name: Build container image
uses: docker/build-push-action@v5
with:
no-cache: true
push: true
context: .
context: ./${{ env.APP_NAME }}
platforms: linux/amd64,linux/arm64
file: Dockerfile
tags: ghcr.io/${{ github.repository }}:${{ env.VERSION }}-cpu
tags: ghcr.io/${{ github.repository }}/${{ env.APP_NAME }}:${{ env.VERSION }}-cpu
build-args: |
BUILD_TYPE=cpu
55 changes: 49 additions & 6 deletions .github/workflows/publish-docker-cuda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,56 @@ jobs:
push_to_registry:
name: Build image
runs-on: ubuntu-22.04
if: ${{ github.repository_owner == 'nextcloud' }} # REPLACE THIS WITH YOUR ORGANIZATION NAME
if: ${{ github.repository_owner == 'nextcloud' }}
permissions:
packages: write
contents: read
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Set app env
run: |
# Split and keep last
echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
echo "APP_VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
with:
path: ${{ env.APP_NAME }}

- name: Read package.json node and npm engines version
uses: skjnldsv/read-package-engines-version-actions@0ce2ed60f6df073a62a77c0a4958dd0fc68e32e7 # v2.1
id: versions
# Continue if no package.json
continue-on-error: true
with:
path: ${{ env.APP_NAME }}
fallbackNode: "^20"
fallbackNpm: "^10"

- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
# Skip if no package.json
if: ${{ steps.versions.outputs.nodeVersion }}
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3
with:
node-version: ${{ steps.versions.outputs.nodeVersion }}

- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
# Skip if no package.json
if: ${{ steps.versions.outputs.npmVersion }}
run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"

- name: Build ${{ env.APP_NAME }}
# Skip if no package.json
if: ${{ steps.versions.outputs.nodeVersion }}
run: |
cd ${{ env.APP_NAME }}
npm ci
npm run build
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
Expand All @@ -31,6 +74,7 @@ jobs:
- name: Extract version from XML
id: extract_version
run: |
cd ${{ env.APP_NAME }}
VERSION=$(xmlstarlet sel -t -v "//image-tag" appinfo/info.xml)
echo "VERSION=$VERSION" >> $GITHUB_ENV
Expand All @@ -43,9 +87,8 @@ jobs:
with:
no-cache: true
push: true
context: .
context: ./${{ env.APP_NAME }}
platforms: linux/amd64
file: Dockerfile
tags: ghcr.io/${{ github.repository }}:${{ env.VERSION }}-cuda
tags: ghcr.io/${{ github.repository }}/${{ env.APP_NAME }}:${{ env.VERSION }}-cuda
build-args: |
BUILD_TYPE=cuda
55 changes: 49 additions & 6 deletions .github/workflows/publish-docker-rocm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,56 @@ jobs:
push_to_registry:
name: Build image
runs-on: ubuntu-22.04
if: ${{ github.repository_owner == 'nextcloud' }} # REPLACE THIS WITH YOUR ORGANIZATION NAME
if: ${{ github.repository_owner == 'nextcloud' }}
permissions:
packages: write
contents: read
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Set app env
run: |
# Split and keep last
echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
echo "APP_VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
with:
path: ${{ env.APP_NAME }}

- name: Read package.json node and npm engines version
uses: skjnldsv/read-package-engines-version-actions@0ce2ed60f6df073a62a77c0a4958dd0fc68e32e7 # v2.1
id: versions
# Continue if no package.json
continue-on-error: true
with:
path: ${{ env.APP_NAME }}
fallbackNode: "^20"
fallbackNpm: "^10"

- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
# Skip if no package.json
if: ${{ steps.versions.outputs.nodeVersion }}
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3
with:
node-version: ${{ steps.versions.outputs.nodeVersion }}

- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
# Skip if no package.json
if: ${{ steps.versions.outputs.npmVersion }}
run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"

- name: Build ${{ env.APP_NAME }}
# Skip if no package.json
if: ${{ steps.versions.outputs.nodeVersion }}
run: |
cd ${{ env.APP_NAME }}
npm ci
npm run build
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
Expand All @@ -31,6 +74,7 @@ jobs:
- name: Extract version from XML
id: extract_version
run: |
cd ${{ env.APP_NAME }}
VERSION=$(xmlstarlet sel -t -v "//image-tag" appinfo/info.xml)
echo "VERSION=$VERSION" >> $GITHUB_ENV
Expand All @@ -43,9 +87,8 @@ jobs:
with:
no-cache: true
push: true
context: .
context: ./${{ env.APP_NAME }}
platforms: linux/amd64
file: Dockerfile
tags: ghcr.io/${{ github.repository }}:${{ env.VERSION }}-rocm
tags: ghcr.io/${{ github.repository }}/${{ env.APP_NAME }}:${{ env.VERSION }}-rocm
build-args: |
BUILD_TYPE=rocm

0 comments on commit 799a653

Please sign in to comment.