Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
sdlaver committed Jul 3, 2022
1 parent 04fa605 commit fe2ac21
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 4 deletions.
66 changes: 66 additions & 0 deletions .github/actions/gha-commit-artifact-to-branch/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Commit artifact to branch
description: Commit a GitHub uploaded artifact to a target branch. This is useful for, e.g., committing build output to gh-pages.

inputs:
token:
required: true
type: string
description: a GitHub token to use when committing. If the commit should trigger further workflows (for e.g., a GitHub Pages deployment flow), make sure to use a PAT.
branch:
required: true
type: string
description: the branch name to commit to
artifact-name:
required: true
type: string
description: the name of an artifact (previously uploaded with actions/upload-artifact)
dest:
required: false
type: string
default: ''
description: the destination directory to commit the artifact into
commit-author-name:
required: false
type: string
default: 'Continuous Integration'
description: the Git author name for the generated commit
commit-author-email:
required: false
type: string
default: ''
description: the Git author email for the generated commit
commit-message:
required: false
type: string
default: 'Committing GitHub Actions workflow artifact'
description: the Git commit message

runs:
using: composite
steps:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.branch }}
path: .commit-artifact-to-branch-${{ inputs.artifact-name }}-${{ inputs.branch }}
token: ${{ inputs.token }}
- name: Clear dest
run: rm -rfv ./'${{ inputs.dest }}'/*
shell: bash
working-directory: .commit-artifact-to-branch-${{ inputs.artifact-name }}-${{ inputs.branch }}
- uses: actions/download-artifact@v3
with:
name: ${{ inputs.artifact-name }}
path: .commit-artifact-to-branch-${{ inputs.artifact-name }}-${{ inputs.branch }}/${{ inputs.dest }}
- name: Commit artifact
run: |
git config user.name '${{ inputs.commit-author-name }}'
git config user.email '${{ inputs.commit-author-email }}'
git add ./'${{ inputs.dest }}'
git diff-index --quiet --cached HEAD -- && {
echo 'Nothing to commit; exiting'
exit 0
}
git commit -m '${{ inputs.commit-message }}' --allow-empty-message
git push --force-with-lease origin '${{ inputs.branch }}'
shell: bash
working-directory: .commit-artifact-to-branch-${{ inputs.artifact-name }}-${{ inputs.branch }}
15 changes: 11 additions & 4 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,17 @@ jobs:
- uses: actions/upload-artifact@v3
with:
name: digitalassetlinks-javadoc
path: digitalassetlinks/build/docs/*
path: |
digitalassetlinks/build/docs/*
!digitalassetlinks/build/docs/**/*.zip
if-no-files-found: error
retention-days: 1
- uses: actions/upload-artifact@v3
with:
name: pay-javadoc
path: pay/build/docs/*
path: |
pay/build/docs/*
!pay/build/docs/**/*.zip
if-no-files-found: error
retention-days: 1

Expand Down Expand Up @@ -79,15 +83,18 @@ jobs:
#if: ${{ github.event_name == 'push' }}

steps:
- uses: actions/checkout@v3 # TODO: temp
- name: Update digitalassetlinks javadoc
uses: solana-mobile/gha-commit-artifact-to-branch@v1
#uses: solana-mobile/gha-commit-artifact-to-branch@v1
uses: ./.github/actions/gha-commit-artifact-to-branch
with:
token: ${{ secrets.UPDATE_GITHUB_PAGES_TOKEN }}
branch: gh-pages
artifact-name: digitalassetlinks-javadoc
dest: digitalassetlinks
- name: Update pay javadoc
uses: solana-mobile/gha-commit-artifact-to-branch@v1
#uses: solana-mobile/gha-commit-artifact-to-branch@v1
uses: ./.github/actions/gha-commit-artifact-to-branch
with:
token: ${{ secrets.UPDATE_GITHUB_PAGES_TOKEN }}
branch: gh-pages
Expand Down

0 comments on commit fe2ac21

Please sign in to comment.