Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automate tool version update ptdata 958 test #462

Merged
merged 42 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
74b0db0
add action
f-peverali Oct 4, 2024
6a3a605
lower firely action for test purposes
f-peverali Oct 4, 2024
8cdb522
fix removing feature
f-peverali Oct 4, 2024
7d4ae67
fix update on main.yml
f-peverali Oct 4, 2024
9ad225c
fix path
f-peverali Oct 4, 2024
c0b015a
fix path
f-peverali Oct 4, 2024
43ab121
fix using force push
f-peverali Oct 4, 2024
18e55e5
fix: trial set permissions
f-peverali Oct 4, 2024
cd01761
fix using PR
f-peverali Oct 4, 2024
8908591
fix variable setting
f-peverali Oct 4, 2024
05d0c33
fix : try js script instead of action for PR
f-peverali Oct 4, 2024
ed74c2a
update sushi for test
f-peverali Oct 4, 2024
835e63f
add test comment
f-peverali Oct 4, 2024
7666323
fix automated
f-peverali Oct 4, 2024
9b01051
fix trial
f-peverali Oct 4, 2024
3354e45
add python script for updating sushi and firely terminal
f-peverali Oct 4, 2024
6e2e212
rm pr feature
f-peverali Oct 4, 2024
0682207
fix trial using secret
f-peverali Oct 4, 2024
27140b6
fix trial update permision / key
f-peverali Oct 4, 2024
4c8f62e
fix trial
f-peverali Oct 4, 2024
cb20c8e
fix trial
f-peverali Oct 4, 2024
afadc3a
add notification action
f-peverali Oct 7, 2024
616ef2b
update warning
f-peverali Oct 7, 2024
cf610c3
update warning
f-peverali Oct 7, 2024
78d27b7
fix if statement
f-peverali Oct 7, 2024
27dcabc
update trigger
f-peverali Oct 7, 2024
2fe452e
update name of wokflow
f-peverali Oct 7, 2024
116f591
add skipping step
f-peverali Oct 7, 2024
7502861
fix skipping step
f-peverali Oct 7, 2024
6330045
fix trial
f-peverali Oct 7, 2024
252ea8c
update permission and execute
f-peverali Oct 7, 2024
c2cf50c
update token variables
f-peverali Oct 7, 2024
886af7f
fix permissions
f-peverali Oct 7, 2024
23f087f
tidy up
f-peverali Oct 7, 2024
ac38a61
update documentation and todo
f-peverali Oct 7, 2024
b4ba30e
rename script
f-peverali Oct 7, 2024
9db9aac
fix name
f-peverali Oct 7, 2024
96dfb2b
fix name
f-peverali Oct 7, 2024
e5bee6b
sushi and firely automated update
leslieber Oct 16, 2024
2eb3b18
Test workflow
leslieber Oct 16, 2024
e805b8e
sushi update without v
leslieber Oct 16, 2024
6f2105c
Update dependencies to versions Firely: v0.4.2, Sushi: 3.12.0 (#461)
github-actions[bot] Oct 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions .github/workflows/ToolUpdate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
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

permissions:
contents: write
pull-requests: write

jobs:
update-dependency:
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: 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 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: 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) {
throw new Error('Versions are not defined');
}
const prTitle = `Update dependencies to versions Firely: ${latestVersionFirely}, Sushi: ${latestVersionSushi}`;
const prHead = `update-dependency-${latestVersionFirely}-${latestVersionSushi}`;
const prBody = `This PR updates the dependencies to versions Firely: ${latestVersionFirely} and Sushi: ${latestVersionSushi}.`;
const { data: pullRequest } = await github.rest.pulls.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: prTitle,
head: prHead,
base: context.ref.replace('refs/heads/', ''),
body: prBody,
maintainer_can_modify: true,
});
console.log(`Created pull request: ${pullRequest.html_url}`);
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
# Java and .NET are already installed on ubuntu-latest

- name: Firely.Terminal (GitHub Actions)
uses: FirelyTeam/firely-terminal-pipeline@v0.4.1
uses: FirelyTeam/firely-terminal-pipeline@v0.4.2
with:
PATH_TO_CONFORMANCE_RESOURCES: Resources/fsh-generated/resources/
#PATH_TO_EXAMPLES: Examples
Expand All @@ -46,7 +46,7 @@ jobs:
SIMPLIFIER_PASSWORD: ${{ secrets.SIMPLIFIER_PASSWORD }}
SUSHI_ENABLED: true
SUSHI_OPTIONS: Resources/
SUSHI_VERSION: 3.8.0
SUSHI_VERSION: 3.12.0
EXPECTED_FAILS: VALIDATION_CONFORMANCE_DOTNET VALIDATION_CONFORMANCE_JAVA VALIDATION_EXAMPLES_JAVA

- name: Add & Commit
Expand Down
30 changes: 30 additions & 0 deletions scripts/update-compile-and-validation-tools.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
### This script updates the main.yml file with the latest versions of firely-terminal and sushi and can be used locally
import requests
import os

def get_latest_version(repo):
url = f"https://api.github.com/repos/{repo}/releases/latest"
response = requests.get(url)
response.raise_for_status()
return response.json()["tag_name"]

if __name__ == "__main__":
firely_terminal_version = get_latest_version("FirelyTeam/firely-terminal-pipeline")
sushi_version = get_latest_version("FHIR/sushi")

script_dir = os.path.dirname(__file__)
main_yml_path = os.path.abspath(os.path.join(script_dir, "../.github/workflows/main.yml"))

with open(main_yml_path, "r") as file:
lines = file.readlines()

with open(main_yml_path, "w") as file:
for line in lines:
if line.strip().startswith("uses: FirelyTeam/firely-terminal-pipeline@"):
file.write(f" uses: FirelyTeam/firely-terminal-pipeline@{firely_terminal_version}\n")
elif line.strip().startswith("SUSHI_VERSION:"):
file.write(f" SUSHI_VERSION: {sushi_version}\n")
else:
file.write(line)

print(f"Updated main.yml with firely-terminal=={firely_terminal_version} and sushi=={sushi_version}")
Loading