From 0840f27382d5b2b1720d1674862d4f6631440254 Mon Sep 17 00:00:00 2001 From: Jerry Dimitriou Date: Thu, 19 Sep 2024 15:52:29 +0300 Subject: [PATCH 1/9] fixed zip file build --- .github/workflows/build-and-deploy-branch.yml | 3 +++ build.sh | 7 +++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-and-deploy-branch.yml b/.github/workflows/build-and-deploy-branch.yml index 28eadc18..968dd87d 100644 --- a/.github/workflows/build-and-deploy-branch.yml +++ b/.github/workflows/build-and-deploy-branch.yml @@ -10,6 +10,9 @@ jobs: steps: - name: Checkout source code uses: actions/checkout@v2 + + - name: Install zip + run: apt install -y zip - name: Build Spec run: bash ./build.sh diff --git a/build.sh b/build.sh index de221e2e..d478584b 100755 --- a/build.sh +++ b/build.sh @@ -20,12 +20,11 @@ docker run --rm -i -v $PROJECT:/src anskaffelser/validator:2.1.0 build -x -t -n for sch in $PROJECT/rules/sch/*.sch; do docker run --rm -i -v $PROJECT:/src -v $PROJECT/target/schematron:/target klakegg/schematron prepare /src/rules/sch/$(basename $sch) /target/$(basename $sch) done -docker run --rm -i -v $PROJECT/target/site/files:/src alpine:3.6 rm -rf /src/PEPPOLBIS-Upgrade-Schematron.zip -docker run --rm -i -v $PROJECT/target/schematron:/src -v $PROJECT/target/site/files:/target -w /src kramos/alpine-zip -r /target/PEPPOLBIS-Upgrade-Schematron.zip . +rm -rf /src/PEPPOLBIS-Upgrade-Schematron.zip +zip -r target/site/files/PEPPOLBIS-Upgrade-Schematron.zip target/schematron # Example files -docker run --rm -i -v $PROJECT/target/site/files:/src alpine:3.6 rm -rf /src/PEPPOLBIS-Examples.zip -docker run --rm -i -v $PROJECT/rules/examples:/src -v $PROJECT/target/site/files:/target -w /src kramos/alpine-zip -r /target/PEPPOLBIS-Examples.zip . +zip -r target/site/files/PEPPOLBIS-Examples.zip rules/examples # Guides docker run --rm -i -v $PROJECT:/documents -v $PROJECT/target:/target difi/asciidoctor From d43f6293f264dc81a74b947e120bcc60cdf56c8c Mon Sep 17 00:00:00 2001 From: Jerry Dimitriou Date: Thu, 19 Sep 2024 16:00:39 +0300 Subject: [PATCH 2/9] removed zip install --- .github/workflows/build-and-deploy-branch.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-deploy-branch.yml b/.github/workflows/build-and-deploy-branch.yml index 968dd87d..79d4c457 100644 --- a/.github/workflows/build-and-deploy-branch.yml +++ b/.github/workflows/build-and-deploy-branch.yml @@ -11,8 +11,8 @@ jobs: - name: Checkout source code uses: actions/checkout@v2 - - name: Install zip - run: apt install -y zip +# - name: Install zip +# run: apt install -y zip - name: Build Spec run: bash ./build.sh From 611384f024e3c268721a96424b3b8b0aa4f23d2b Mon Sep 17 00:00:00 2001 From: Jerry Dimitriou Date: Thu, 19 Sep 2024 17:34:01 +0300 Subject: [PATCH 3/9] zip fix --- build.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/build.sh b/build.sh index d478584b..5a993223 100755 --- a/build.sh +++ b/build.sh @@ -20,11 +20,16 @@ docker run --rm -i -v $PROJECT:/src anskaffelser/validator:2.1.0 build -x -t -n for sch in $PROJECT/rules/sch/*.sch; do docker run --rm -i -v $PROJECT:/src -v $PROJECT/target/schematron:/target klakegg/schematron prepare /src/rules/sch/$(basename $sch) /target/$(basename $sch) done -rm -rf /src/PEPPOLBIS-Upgrade-Schematron.zip -zip -r target/site/files/PEPPOLBIS-Upgrade-Schematron.zip target/schematron + +# Fix ownership +docker run --rm -i -v $PROJECT:/src alpine:3.6 chown -R $(id -g $USER).$(id -g $USER) /src/target + +rm -rf $PROJECT/target/site/files/PEPPOLBIS-Upgrade-Schematron.zip +zip -r $PROJECT/target/site/files/PEPPOLBIS-Upgrade-Schematron.zip target/schematron # Example files -zip -r target/site/files/PEPPOLBIS-Examples.zip rules/examples +rm -rf $PROJECT/target/site/files/PEPPOLBIS-Examples.zip +zip -r $PROJECT/target/site/files/PEPPOLBIS-Examples.zip $PROJECT/rules/examples # Guides docker run --rm -i -v $PROJECT:/documents -v $PROJECT/target:/target difi/asciidoctor From f6fd216cc65d4693e288934c3971a8394ce4c554 Mon Sep 17 00:00:00 2001 From: Jerry Dimitriou Date: Thu, 19 Sep 2024 17:43:07 +0300 Subject: [PATCH 4/9] debug info --- build.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 5a993223..834365d9 100755 --- a/build.sh +++ b/build.sh @@ -21,10 +21,15 @@ for sch in $PROJECT/rules/sch/*.sch; do docker run --rm -i -v $PROJECT:/src -v $PROJECT/target/schematron:/target klakegg/schematron prepare /src/rules/sch/$(basename $sch) /target/$(basename $sch) done +# Show permissions +ls -Rla # Fix ownership docker run --rm -i -v $PROJECT:/src alpine:3.6 chown -R $(id -g $USER).$(id -g $USER) /src/target -rm -rf $PROJECT/target/site/files/PEPPOLBIS-Upgrade-Schematron.zip +# Show permissions +ls -Rla + +sudo rm -rf $PROJECT/target/site/files/PEPPOLBIS-Upgrade-Schematron.zip zip -r $PROJECT/target/site/files/PEPPOLBIS-Upgrade-Schematron.zip target/schematron # Example files From 04b4fb63ba1f7fed0e543390d4686d2de9beb17a Mon Sep 17 00:00:00 2001 From: Jerry Dimitriou Date: Thu, 19 Sep 2024 17:47:35 +0300 Subject: [PATCH 5/9] remove debug --- build.sh | 5 ----- 1 file changed, 5 deletions(-) diff --git a/build.sh b/build.sh index 834365d9..f5812727 100755 --- a/build.sh +++ b/build.sh @@ -21,14 +21,9 @@ for sch in $PROJECT/rules/sch/*.sch; do docker run --rm -i -v $PROJECT:/src -v $PROJECT/target/schematron:/target klakegg/schematron prepare /src/rules/sch/$(basename $sch) /target/$(basename $sch) done -# Show permissions -ls -Rla # Fix ownership docker run --rm -i -v $PROJECT:/src alpine:3.6 chown -R $(id -g $USER).$(id -g $USER) /src/target -# Show permissions -ls -Rla - sudo rm -rf $PROJECT/target/site/files/PEPPOLBIS-Upgrade-Schematron.zip zip -r $PROJECT/target/site/files/PEPPOLBIS-Upgrade-Schematron.zip target/schematron From 011a9eab38685cdd3b74f78282056d0d37dacb81 Mon Sep 17 00:00:00 2001 From: Jerry Dimitriou Date: Thu, 19 Sep 2024 17:49:28 +0300 Subject: [PATCH 6/9] sudo --- build.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.sh b/build.sh index f5812727..0c6bddcf 100755 --- a/build.sh +++ b/build.sh @@ -25,11 +25,11 @@ done docker run --rm -i -v $PROJECT:/src alpine:3.6 chown -R $(id -g $USER).$(id -g $USER) /src/target sudo rm -rf $PROJECT/target/site/files/PEPPOLBIS-Upgrade-Schematron.zip -zip -r $PROJECT/target/site/files/PEPPOLBIS-Upgrade-Schematron.zip target/schematron +sudo zip -r $PROJECT/target/site/files/PEPPOLBIS-Upgrade-Schematron.zip target/schematron # Example files -rm -rf $PROJECT/target/site/files/PEPPOLBIS-Examples.zip -zip -r $PROJECT/target/site/files/PEPPOLBIS-Examples.zip $PROJECT/rules/examples +sudo rm -rf $PROJECT/target/site/files/PEPPOLBIS-Examples.zip +sudo zip -r $PROJECT/target/site/files/PEPPOLBIS-Examples.zip $PROJECT/rules/examples # Guides docker run --rm -i -v $PROJECT:/documents -v $PROJECT/target:/target difi/asciidoctor From c601690354fe9ae972cba5b4fdc033b47235bc68 Mon Sep 17 00:00:00 2001 From: Jerry Dimitriou Date: Thu, 19 Sep 2024 18:02:01 +0300 Subject: [PATCH 7/9] fixes paths inside zip --- build-actions.sh | 40 ++++++++++++++++++++++++++++++++++++++++ build.sh | 11 +++++++---- 2 files changed, 47 insertions(+), 4 deletions(-) create mode 100755 build-actions.sh diff --git a/build-actions.sh b/build-actions.sh new file mode 100755 index 00000000..cfc6b8c8 --- /dev/null +++ b/build-actions.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +PROJECT=$(dirname $(readlink -f "$0")) + +# Delete target folder if found +if [ -e $PROJECT/target ]; then + docker run --rm -i -v $PROJECT:/src alpine:3.6 rm -rf /src/target +fi + +# Structure +docker run --rm -i \ + -v $PROJECT:/src \ + -v $PROJECT/target:/target \ + difi/vefa-structure:0.6.1 + +# Testing validation rules +docker run --rm -i -v $PROJECT:/src anskaffelser/validator:2.1.0 build -x -t -n eu.peppol.poacc.upgrade.v3 -a rules -target target/validator-test /src + +# Schematron +for sch in $PROJECT/rules/sch/*.sch; do + docker run --rm -i -v $PROJECT:/src -v $PROJECT/target/schematron:/target klakegg/schematron prepare /src/rules/sch/$(basename $sch) /target/$(basename $sch) +done + +# Fix ownership +docker run --rm -i -v $PROJECT:/src alpine:3.6 chown -R $(id -g $USER).$(id -g $USER) /src/target + +rm -rf $PROJECT/target/site/files/PEPPOLBIS-Upgrade-Schematron.zip +rm -rf $PROJECT/target/site/files/PEPPOLBIS-Examples.zip + +cd $PROJECT/target +zip -r site/files/PEPPOLBIS-Upgrade-Schematron.zip schematron/ + +cd $PROJECT +zip -r target/site/files/PEPPOLBIS-Examples.zip rules/examples + +# Guides +docker run --rm -i -v $PROJECT:/documents -v $PROJECT/target:/target difi/asciidoctor + +# Fix ownership +docker run --rm -i -v $PROJECT:/src alpine:3.6 chown -R $(id -g $USER).$(id -g $USER) /src/target diff --git a/build.sh b/build.sh index 0c6bddcf..4b8aa2de 100755 --- a/build.sh +++ b/build.sh @@ -24,12 +24,15 @@ done # Fix ownership docker run --rm -i -v $PROJECT:/src alpine:3.6 chown -R $(id -g $USER).$(id -g $USER) /src/target -sudo rm -rf $PROJECT/target/site/files/PEPPOLBIS-Upgrade-Schematron.zip -sudo zip -r $PROJECT/target/site/files/PEPPOLBIS-Upgrade-Schematron.zip target/schematron +rm -rf $PROJECT/target/site/files/PEPPOLBIS-Upgrade-Schematron.zip +rm -rf $PROJECT/target/site/files/PEPPOLBIS-Examples.zip + +cd $PROJECT/target +zip -r site/files/PEPPOLBIS-Upgrade-Schematron.zip schematron/ # Example files -sudo rm -rf $PROJECT/target/site/files/PEPPOLBIS-Examples.zip -sudo zip -r $PROJECT/target/site/files/PEPPOLBIS-Examples.zip $PROJECT/rules/examples +cd $PROJECT +zip -r target/site/files/PEPPOLBIS-Examples.zip rules/examples # Guides docker run --rm -i -v $PROJECT:/documents -v $PROJECT/target:/target difi/asciidoctor From 3bbdc41463433c8c243dd23ba4d8c7aa35df00cd Mon Sep 17 00:00:00 2001 From: Jerry Dimitriou Date: Thu, 19 Sep 2024 18:02:17 +0300 Subject: [PATCH 8/9] Added script --- .github/workflows/build-and-deploy-branch.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/build-and-deploy-branch.yml b/.github/workflows/build-and-deploy-branch.yml index 79d4c457..64baa212 100644 --- a/.github/workflows/build-and-deploy-branch.yml +++ b/.github/workflows/build-and-deploy-branch.yml @@ -11,11 +11,8 @@ jobs: - name: Checkout source code uses: actions/checkout@v2 -# - name: Install zip -# run: apt install -y zip - - name: Build Spec - run: bash ./build.sh + run: bash ./build-actions.sh - name: Deploy on S3 env: From 1890c627f6d55e374fdad1b5d966d6160d2ab6e9 Mon Sep 17 00:00:00 2001 From: Jerry Dimitriou Date: Thu, 19 Sep 2024 18:06:22 +0300 Subject: [PATCH 9/9] missing sudo --- build-actions.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build-actions.sh b/build-actions.sh index cfc6b8c8..b8884718 100755 --- a/build-actions.sh +++ b/build-actions.sh @@ -24,14 +24,14 @@ done # Fix ownership docker run --rm -i -v $PROJECT:/src alpine:3.6 chown -R $(id -g $USER).$(id -g $USER) /src/target -rm -rf $PROJECT/target/site/files/PEPPOLBIS-Upgrade-Schematron.zip -rm -rf $PROJECT/target/site/files/PEPPOLBIS-Examples.zip +sudo rm -rf $PROJECT/target/site/files/PEPPOLBIS-Upgrade-Schematron.zip +sudo rm -rf $PROJECT/target/site/files/PEPPOLBIS-Examples.zip cd $PROJECT/target -zip -r site/files/PEPPOLBIS-Upgrade-Schematron.zip schematron/ +sudo zip -r site/files/PEPPOLBIS-Upgrade-Schematron.zip schematron/ cd $PROJECT -zip -r target/site/files/PEPPOLBIS-Examples.zip rules/examples +sudo zip -r target/site/files/PEPPOLBIS-Examples.zip rules/examples # Guides docker run --rm -i -v $PROJECT:/documents -v $PROJECT/target:/target difi/asciidoctor