Skip to content

Commit

Permalink
Flytter ut build jobber til actions
Browse files Browse the repository at this point in the history
  • Loading branch information
torhakon committed Aug 29, 2024
1 parent d0b78ac commit 17ddcad
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 29 deletions.
28 changes: 28 additions & 0 deletions .github/actions/ciBuildAndPublishArtifact/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: "Build and publish artifact"
description: "Build and publish an artifact to github npm registery"
runs:
using: composite
steps:
- name: "Authenticate to npm"
uses: actions/setup-node@v4
with:
registry-url: "https://npm.pkg.github.com"

- name: "Build package"
shell: bash
run: |
sfp build --devhubalias devhub --diffcheck --buildnumber ${GITHUB_RUN_ID} --branch ${GITHUB_REF#refs/heads/}
- name: "Publish"
shell: bash
run: |
sfp publish --artifactdir artifacts --npm --scope @${{ github.repository_owner }} --gittag --pushgittag
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: navikt/sf-platform/.github/actions/uploadWorkflowArtifactsAndLogs@main
with:
artifactName: "build-artifacts"
uploadArtifacts: true
logName: "logs"
publishLogs: true
35 changes: 35 additions & 0 deletions .github/actions/uploadWorkflowArtifactsAndLogs/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: "Upload workflow artifacts and logs"
description: "Uploads logs and sfp generated artifacts to the workflow"
inputs:
artifactName:
description: "Name of the artifact"
required: true
uploadArtifacts:
description: "If true upload the artifacts"
required: true
logName:
description: "Name of the logs"
required: true
publishLogs:
description: "If true upload the flxbl logs"
required: true
runs:
using: composite
steps:
- name: "Publish artifacts"
if: ${{ inputs.uploadArtifacts }}
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.logName }}
path: artifacts
retention-days: 10

# Upload Flxbl logs
- name: "Publish logs"
if: ${{ inputs.publishLogs }}
uses: actions/upload-artifact@v4
with:
name: "${{ inputs.logName }}"
path: .sfpowerscripts
if-no-files-found: ignore
retention-days: 1
60 changes: 31 additions & 29 deletions .github/workflows/ciBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,34 +30,36 @@ jobs:
alias: devhub
setDefaultDevhubUsername: true

- name: "Build package"
run: |
sfp build --devhubalias devhub --diffcheck --buildnumber ${GITHUB_RUN_ID} --branch ${GITHUB_REF#refs/heads/}
- uses: navikt/sf-platform/.github/actions/ciBuildAndPublishArtifact@main

- name: "Publish artifacts"
if: ${{ success() }}
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: artifacts
# - name: "Build package"
# run: |
# sfp build --devhubalias devhub --diffcheck --buildnumber ${GITHUB_RUN_ID} --branch ${GITHUB_REF#refs/heads/}

- name: "Authenticate to npm"
uses: actions/setup-node@v4
with:
registry-url: "https://npm.pkg.github.com"

- name: "Publish"
run: |
sfp publish --artifactdir artifacts --npm --scope @${{ github.repository_owner }} --gittag --pushgittag
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Upload Flxbl logs
- name: "Publish logs"
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: "logs"
path: .sfpowerscripts
if-no-files-found: ignore
retention-days: 1
# - name: "Publish artifacts"
# if: ${{ success() }}
# uses: actions/upload-artifact@v4
# with:
# name: build-artifacts
# path: artifacts

# - name: "Authenticate to npm"
# uses: actions/setup-node@v4
# with:
# registry-url: "https://npm.pkg.github.com"

# - name: "Publish"
# run: |
# sfp publish --artifactdir artifacts --npm --scope @${{ github.repository_owner }} --gittag --pushgittag
# env:
# NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# # Upload Flxbl logs
# - name: "Publish logs"
# if: ${{ always() }}
# uses: actions/upload-artifact@v4
# with:
# name: "logs"
# path: .sfpowerscripts
# if-no-files-found: ignore
# retention-days: 1

0 comments on commit 17ddcad

Please sign in to comment.