Fix: permission denied on files under run/scripts #32
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
name: Build, validate configuration and deploy | |
on: | |
# workflow_dispatch: commenting this to test the workflow | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
java: [ '8' ] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK ${{ matrix.java }} | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: ${{ matrix.java }} | |
cache: 'maven' | |
- name: Set settings.xml | |
uses: s4u/[email protected] | |
with: | |
servers: | | |
[{ | |
"id": "msf-ocg-github-lime-emr", | |
"username": "${{ secrets.MAVEN_GITHUB_ACTIONS_DEPLOY_USERNAME }}", | |
"password": "${{ secrets.MAVEN_GITHUB_ACTIONS_DEPLOY_TOKEN }}" | |
}] | |
- name: Build and Test | |
run: mvn --batch-mode --update-snapshots --activate-profiles validator clean package | |
release: | |
if: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') || github.event_name == 'release' }} | |
runs-on: ubuntu-latest | |
needs: build | |
outputs: | |
directories: ${{ steps.check_dir.outputs.directories }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Trigger build job based on directory | |
id: check_dir | |
run: | | |
if [[ $(git diff --name-only ${{ github.event.before }} ${{ github.sha }}) == *"distro"* ]]; then | |
echo "Triggering the 'release-distro' job and its children" | |
DIRECTORIES=("distro", "iraq", "mosul") | |
echo "directories=${DIRECTORIES}" >> $GITHUB_OUTPUT | |
elif [[ $(git diff --name-only ${{ github.event.before }} ${{ github.sha }}) == *"iraq"* ]]; then | |
echo "Triggering the 'release-iraq' job and its children" | |
DIRECTORIES=("iraq", "mosul") | |
echo "directories=${DIRECTORIES}" >> $GITHUB_OUTPUT | |
elif [[ $(git diff --name-only ${{ github.event.before }} ${{ github.sha }}) == *"mosul"* ]]; then | |
echo "Triggering the 'release-mosul' job" | |
DIRECTORIES=("mosul") | |
echo "directories=${DIRECTORIES}" >> $GITHUB_OUTPUT | |
else | |
echo "No relevant directory changes, skipping build job" | |
DIRECTORIES=() | |
echo "directories=${DIRECTORIES}" >> $GITHUB_OUTPUT | |
fi | |
release-distro: | |
needs: release | |
if: contains(needs.release.outputs.directories, 'distro') | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Publish MSF distro artifacts to GitHub | |
uses: ./.github/actions/upload-maven-artifacts | |
with: | |
artifact-name: "distro" | |
artifact-path: "${{ github.workspace }}/distro" | |
maven-server-username: "${{ secrets.MAVEN_GITHUB_ACTIONS_DEPLOY_USERNAME }}" | |
maven-server-token: "${{ secrets.MAVEN_GITHUB_ACTIONS_DEPLOY_TOKEN }}" | |
release-iraq: | |
needs: [release, release-distro] | |
if: | | |
( always() && !failure() ) || | |
contains(needs.release.outputs.directories, 'iraq') | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Publish MSF Mosul to artifacts GitHub | |
uses: ./.github/actions/upload-maven-artifacts | |
with: | |
artifact-name: "Iraq" | |
artifact-path: "${{ github.workspace }}/countries/iraq" | |
maven-server-username: "${{ secrets.MAVEN_GITHUB_ACTIONS_DEPLOY_USERNAME }}" | |
maven-server-token: "${{ secrets.MAVEN_GITHUB_ACTIONS_DEPLOY_TOKEN }}" | |
release-mosul: | |
needs: [release, release-iraq] | |
if: | | |
( always() && !failure() ) || | |
contains(needs.release.outputs.directories, 'mosul') | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Publish MSF Iraq artifacts to GitHub | |
uses: ./.github/actions/upload-maven-artifacts | |
with: | |
artifact-name: "Mosul" | |
artifact-path: "${{ github.workspace }}/sites/mosul" | |
maven-server-username: "${{ secrets.MAVEN_GITHUB_ACTIONS_DEPLOY_USERNAME }}" | |
maven-server-token: "${{ secrets.MAVEN_GITHUB_ACTIONS_DEPLOY_TOKEN }}" |