From d7d3ebf3658d3c149b7d322bbfbb061463818efc Mon Sep 17 00:00:00 2001 From: Leslie Bernhardt Date: Tue, 22 Oct 2024 12:45:37 +0200 Subject: [PATCH 1/4] include workflow_call variable --- .github/workflows/ToolUpdate.yml | 99 ++++++++++++++++---------------- 1 file changed, 50 insertions(+), 49 deletions(-) diff --git a/.github/workflows/ToolUpdate.yml b/.github/workflows/ToolUpdate.yml index 1e629d66..61012f60 100644 --- a/.github/workflows/ToolUpdate.yml +++ b/.github/workflows/ToolUpdate.yml @@ -1,10 +1,15 @@ name: Update Dependency -on: # Trigger on commits to any branch and manual trigger - workflow_dispatch: # Allows manual trigger - push: - branches: - - '**' # Trigger on commits to any branch +on: + push: + branches: + - '**' # Trigger on commits to any branch + schedule: + - cron: '0 0 * * *' # Runs at 00:00 UTC every day + workflow_call: + secrets: + WORKFLOW_PERMISSION_GITHUB: + required: true permissions: contents: write @@ -15,56 +20,52 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout repository - uses: actions/checkout@v2 - with: - token: ${{ secrets.WORKFLOW_PERMISSION_GITHUB }} # Personal access token with workflow permissions + - name: Checkout repository + uses: actions/checkout@v2 + with: + token: ${{ secrets.WORKFLOW_PERMISSION_GITHUB }} # Personal access token with workflow permissions - - name: Set up jq - run: sudo apt-get install jq + - name: Set up jq + run: sudo apt-get install jq - - name: Fetch latest version of firely terminal dependency - id: fetch_version_firely - run: | - # Fetch the latest version from the FirelyTeam/firely-terminal-pipeline GitHub repository - LATEST_VERSION_FIRELY=$(curl -s https://api.github.com/repos/FirelyTeam/firely-terminal-pipeline/releases/latest | jq -r .tag_name) - echo "LATEST_VERSION_FIRELY=$LATEST_VERSION_FIRELY" >> $GITHUB_ENV - echo $LATEST_VERSION_FIRELY + - name: Fetch latest version of firely terminal dependency + id: fetch_version_firely + run: | + # Fetch the latest version from the FirelyTeam/firely-terminal-pipeline GitHub repository + LATEST_VERSION_FIRELY=$(curl -s https://api.github.com/repos/FirelyTeam/firely-terminal-pipeline/releases/latest | jq -r .tag_name) + echo "LATEST_VERSION_FIRELY=$LATEST_VERSION_FIRELY" >> $GITHUB_ENV + echo $LATEST_VERSION_FIRELY - - name: Fetch latest version of Sushi dependency - id: fetch_version_sushi - run: | - # Fetch the latest version from the fhir/sushi GitHub repository - LATEST_VERSION_SUSHI=$(curl -s https://api.github.com/repos/FHIR/sushi/releases/latest | jq -r .tag_name | sed 's/^v//') - echo "LATEST_VERSION_SUSHI=$LATEST_VERSION_SUSHI" >> $GITHUB_ENV - echo $LATEST_VERSION_SUSHI + - name: Fetch latest version of Sushi dependency + id: fetch_version_sushi + run: | + # Fetch the latest version from the fhir/sushi GitHub repository + LATEST_VERSION_SUSHI=$(curl -s https://api.github.com/repos/FHIR/sushi/releases/latest | jq -r .tag_name | sed 's/^v//') + echo "LATEST_VERSION_SUSHI=$LATEST_VERSION_SUSHI" >> $GITHUB_ENV + echo $LATEST_VERSION_SUSHI - - # TODO add an if statement to prevent the workflow from running if the version is the same as the one in the main.yml file + - name: Update main.yml for Firely and Sushi + run: | + # Update the main.yml file with the new versions of Firely and Sushi + sed -i "s|uses: FirelyTeam/firely-terminal-pipeline@.*|uses: FirelyTeam/firely-terminal-pipeline@$LATEST_VERSION_FIRELY|" .github/workflows/main.yml + sed -i "s|SUSHI_VERSION: .*|SUSHI_VERSION: $LATEST_VERSION_SUSHI|" .github/workflows/main.yml - - - name: Update main.yml for Firely and Sushi - run: | - # Update the main.yml file with the new versions of Firely and Sushi - sed -i "s|uses: FirelyTeam/firely-terminal-pipeline@.*|uses: FirelyTeam/firely-terminal-pipeline@$LATEST_VERSION_FIRELY|" .github/workflows/main.yml - sed -i "s|SUSHI_VERSION: .*|SUSHI_VERSION: $LATEST_VERSION_SUSHI|" .github/workflows/main.yml + - name: Commit changes + env: + GITHUB_TOKEN: ${{ github.token }} + run: | + # Commit the changes + git config --global user.name 'github-actions[bot]' + git config --global user.email 'github-actions[bot]@users.noreply.github.com' + git checkout -b update-dependency-${LATEST_VERSION_FIRELY}-${LATEST_VERSION_SUSHI} || git checkout update-dependency-${LATEST_VERSION_FIRELY}-${LATEST_VERSION_SUSHI} + git add .github/workflows/main.yml + git commit -m "Update dependencies to versions Firely: ${LATEST_VERSION_FIRELY}, Sushi: ${LATEST_VERSION_SUSHI}" + git push https://x-access-token:${{ secrets.WORKFLOW_PERMISSION_GITHUB }}@github.com/${{ github.repository }}.git update-dependency-${LATEST_VERSION_FIRELY}-${LATEST_VERSION_SUSHI} - - name: Commit changes - env: - GITHUB_TOKEN: ${{ github.token }} - run: | - # Commit the changes - git config --global user.name 'github-actions[bot]' - git config --global user.email 'github-actions[bot]@users.noreply.github.com' - git checkout -b update-dependency-${LATEST_VERSION_FIRELY}-${LATEST_VERSION_SUSHI} || git checkout update-dependency-${LATEST_VERSION_FIRELY}-${LATEST_VERSION_SUSHI} - git add .github/workflows/main.yml - git commit -m "Update dependencies to versions Firely: ${LATEST_VERSION_FIRELY}, Sushi: ${LATEST_VERSION_SUSHI}" - git push https://x-access-token:${{ secrets.WORKFLOW_PERMISSION_GITHUB }}@github.com/${{ github.repository }}.git update-dependency-${LATEST_VERSION_FIRELY}-${LATEST_VERSION_SUSHI} - - - name: Create Pull Request - uses: actions/github-script@v6 - with: - script: | + - name: Create Pull Request + uses: actions/github-script@v6 + with: + script: | const latestVersionFirely = process.env.LATEST_VERSION_FIRELY; const latestVersionSushi = process.env.LATEST_VERSION_SUSHI; if (!latestVersionFirely || !latestVersionSushi) { From 7d3da17334ed0e9ce7059c93cc19ecb8eff44102 Mon Sep 17 00:00:00 2001 From: Leslie Bernhardt Date: Tue, 22 Oct 2024 13:31:09 +0200 Subject: [PATCH 2/4] add workflow_call in main --- .github/workflows/main.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5d2438a4..16c1d38f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -13,6 +13,10 @@ on: pull_request: branches: - 'main**' + workflow_call: + secrets: + WORKFLOW_PERMISSION_GITHUB: + required: true # Allows you to run this workflow manually from the Actions tab workflow_dispatch: From 049e41bc5f7bce373365eb1c0a4437f9718a6074 Mon Sep 17 00:00:00 2001 From: Leslie Bernhardt Date: Tue, 22 Oct 2024 13:46:14 +0200 Subject: [PATCH 3/4] update secrets --- .github/workflows/main.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 16c1d38f..3ba0b9fa 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -15,6 +15,10 @@ on: - 'main**' workflow_call: secrets: + SIMPLIFIER_USERNAME: + required: true + SIMPLIFIER_PASSWORD: + required: true WORKFLOW_PERMISSION_GITHUB: required: true From 8005ffcc13ba087e922e692879be3e182946b24f Mon Sep 17 00:00:00 2001 From: Leslie Bernhardt Date: Tue, 22 Oct 2024 14:21:20 +0200 Subject: [PATCH 4/4] update tool update --- .github/workflows/ToolUpdate.yml | 101 ++++++++++++++++--------------- 1 file changed, 51 insertions(+), 50 deletions(-) diff --git a/.github/workflows/ToolUpdate.yml b/.github/workflows/ToolUpdate.yml index 61012f60..78667ef7 100644 --- a/.github/workflows/ToolUpdate.yml +++ b/.github/workflows/ToolUpdate.yml @@ -1,15 +1,12 @@ name: Update Dependency -on: - push: - branches: - - '**' # Trigger on commits to any branch - schedule: - - cron: '0 0 * * *' # Runs at 00:00 UTC every day - workflow_call: - secrets: - WORKFLOW_PERMISSION_GITHUB: - required: true +on: # Trigger on commits to any branch and manual trigger + workflow_dispatch: # Allows manual trigger + push: + branches: + - '**' # Trigger on commits to any branch + schedule: + - cron: '0 0 * * *' # Runs at 00:00 UTC every day permissions: contents: write @@ -20,52 +17,56 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout repository - uses: actions/checkout@v2 - with: - token: ${{ secrets.WORKFLOW_PERMISSION_GITHUB }} # Personal access token with workflow permissions + - name: Checkout repository + uses: actions/checkout@v2 + with: + token: ${{ secrets.WORKFLOW_PERMISSION_GITHUB }} # Personal access token with workflow permissions - - name: Set up jq - run: sudo apt-get install jq + - name: Set up jq + run: sudo apt-get install jq - - name: Fetch latest version of firely terminal dependency - id: fetch_version_firely - run: | - # Fetch the latest version from the FirelyTeam/firely-terminal-pipeline GitHub repository - LATEST_VERSION_FIRELY=$(curl -s https://api.github.com/repos/FirelyTeam/firely-terminal-pipeline/releases/latest | jq -r .tag_name) - echo "LATEST_VERSION_FIRELY=$LATEST_VERSION_FIRELY" >> $GITHUB_ENV - echo $LATEST_VERSION_FIRELY + - name: Fetch latest version of firely terminal dependency + id: fetch_version_firely + run: | + # Fetch the latest version from the FirelyTeam/firely-terminal-pipeline GitHub repository + LATEST_VERSION_FIRELY=$(curl -s https://api.github.com/repos/FirelyTeam/firely-terminal-pipeline/releases/latest | jq -r .tag_name) + echo "LATEST_VERSION_FIRELY=$LATEST_VERSION_FIRELY" >> $GITHUB_ENV + echo $LATEST_VERSION_FIRELY - - name: Fetch latest version of Sushi dependency - id: fetch_version_sushi - run: | - # Fetch the latest version from the fhir/sushi GitHub repository - LATEST_VERSION_SUSHI=$(curl -s https://api.github.com/repos/FHIR/sushi/releases/latest | jq -r .tag_name | sed 's/^v//') - echo "LATEST_VERSION_SUSHI=$LATEST_VERSION_SUSHI" >> $GITHUB_ENV - echo $LATEST_VERSION_SUSHI + - name: Fetch latest version of Sushi dependency + id: fetch_version_sushi + run: | + # Fetch the latest version from the fhir/sushi GitHub repository + LATEST_VERSION_SUSHI=$(curl -s https://api.github.com/repos/FHIR/sushi/releases/latest | jq -r .tag_name | sed 's/^v//') + echo "LATEST_VERSION_SUSHI=$LATEST_VERSION_SUSHI" >> $GITHUB_ENV + echo $LATEST_VERSION_SUSHI - - name: Update main.yml for Firely and Sushi - run: | - # Update the main.yml file with the new versions of Firely and Sushi - sed -i "s|uses: FirelyTeam/firely-terminal-pipeline@.*|uses: FirelyTeam/firely-terminal-pipeline@$LATEST_VERSION_FIRELY|" .github/workflows/main.yml - sed -i "s|SUSHI_VERSION: .*|SUSHI_VERSION: $LATEST_VERSION_SUSHI|" .github/workflows/main.yml + + # TODO add an if statement to prevent the workflow from running if the version is the same as the one in the main.yml file - - name: Commit changes - env: - GITHUB_TOKEN: ${{ github.token }} - run: | - # Commit the changes - git config --global user.name 'github-actions[bot]' - git config --global user.email 'github-actions[bot]@users.noreply.github.com' - git checkout -b update-dependency-${LATEST_VERSION_FIRELY}-${LATEST_VERSION_SUSHI} || git checkout update-dependency-${LATEST_VERSION_FIRELY}-${LATEST_VERSION_SUSHI} - git add .github/workflows/main.yml - git commit -m "Update dependencies to versions Firely: ${LATEST_VERSION_FIRELY}, Sushi: ${LATEST_VERSION_SUSHI}" - git push https://x-access-token:${{ secrets.WORKFLOW_PERMISSION_GITHUB }}@github.com/${{ github.repository }}.git update-dependency-${LATEST_VERSION_FIRELY}-${LATEST_VERSION_SUSHI} + + - name: Update main.yml for Firely and Sushi + run: | + # Update the main.yml file with the new versions of Firely and Sushi + sed -i "s|uses: FirelyTeam/firely-terminal-pipeline@.*|uses: FirelyTeam/firely-terminal-pipeline@$LATEST_VERSION_FIRELY|" .github/workflows/main.yml + sed -i "s|SUSHI_VERSION: .*|SUSHI_VERSION: $LATEST_VERSION_SUSHI|" .github/workflows/main.yml - - name: Create Pull Request - uses: actions/github-script@v6 - with: - script: | + - name: Commit changes + env: + GITHUB_TOKEN: ${{ github.token }} + run: | + # Commit the changes + git config --global user.name 'github-actions[bot]' + git config --global user.email 'github-actions[bot]@users.noreply.github.com' + git checkout -b update-dependency-${LATEST_VERSION_FIRELY}-${LATEST_VERSION_SUSHI} || git checkout update-dependency-${LATEST_VERSION_FIRELY}-${LATEST_VERSION_SUSHI} + git add .github/workflows/main.yml + git commit -m "Update dependencies to versions Firely: ${LATEST_VERSION_FIRELY}, Sushi: ${LATEST_VERSION_SUSHI}" + git push https://x-access-token:${{ secrets.WORKFLOW_PERMISSION_GITHUB }}@github.com/${{ github.repository }}.git update-dependency-${LATEST_VERSION_FIRELY}-${LATEST_VERSION_SUSHI} + + - name: Create Pull Request + uses: actions/github-script@v6 + with: + script: | const latestVersionFirely = process.env.LATEST_VERSION_FIRELY; const latestVersionSushi = process.env.LATEST_VERSION_SUSHI; if (!latestVersionFirely || !latestVersionSushi) {