From e192a45bd9baf7d3cbf1fc1e9761d6dc2fadd804 Mon Sep 17 00:00:00 2001 From: Reuben Swartz Date: Wed, 22 Jun 2022 16:47:08 -0400 Subject: [PATCH 1/2] Added verse ids --- .../HTMLRenderTest.cs | 89 ++++++++++--------- USFMToolsSharp.Renderers.HTML/HtmlRenderer.cs | 10 ++- .../USFMToolsSharp.Renderers.HTML.csproj | 50 +++++------ 3 files changed, 79 insertions(+), 70 deletions(-) diff --git a/USFMToolsSharp.Renderers.HTML.Tests/HTMLRenderTest.cs b/USFMToolsSharp.Renderers.HTML.Tests/HTMLRenderTest.cs index 64fcbcf..9d72fa3 100644 --- a/USFMToolsSharp.Renderers.HTML.Tests/HTMLRenderTest.cs +++ b/USFMToolsSharp.Renderers.HTML.Tests/HTMLRenderTest.cs @@ -83,22 +83,23 @@ public void TestChapterRender() public void TestVerseRender() { - Assert.AreEqual("200Genesis", WrapTest("\\v 200 Genesis")); - Assert.AreEqual("0fff", WrapTest("\\v 0 fff")); - Assert.AreEqual("
11asdfasdf
", WrapTest("\\c 1 \\v 1 asdfasdf")); + Assert.AreEqual("200Genesis", WrapTest("\\v 200 Genesis")); + Assert.AreEqual("0fff", WrapTest("\\v 0 fff")); + Assert.AreEqual("
11asdfasdf
", WrapTest("\\c 1 \\v 1 asdfasdf")); + // References - Quoted book title - Parallel passage reference - Assert.AreEqual("14Itulah sebabnya kata-kata ini ditulis dalam Kitab Peperangan TUHAN,", WrapTest("\\v 14 Itulah sebabnya kata-kata ini ditulis dalam \\bk Kitab Peperangan TUHAN,\\bk*")); - Assert.AreEqual("5For God never said to any of his angels,
\"You are my Son;
today I have become your Father.\"
Psa 2.7
", WrapTest("\\v 5 For God never said to any of his angels,\\q1 \"You are my Son;\\q2 today I have become your Father.\"\\rq Psa 2.7\\rq* ")); + Assert.AreEqual("14Itulah sebabnya kata-kata ini ditulis dalam Kitab Peperangan TUHAN,", WrapTest("\\v 14 Itulah sebabnya kata-kata ini ditulis dalam \\bk Kitab Peperangan TUHAN,\\bk*")); + Assert.AreEqual("5For God never said to any of his angels,
\"You are my Son;
today I have become your Father.\"
Psa 2.7
", WrapTest("\\v 5 For God never said to any of his angels,\\q1 \"You are my Son;\\q2 today I have become your Father.\"\\rq Psa 2.7\\rq* ")); // Closing - Selah Assert.AreEqual("
[[ayt.co/Mat]]
", WrapTest("\\cls [[ayt.co/Mat]]")); - Assert.AreEqual("3Allah datang dari negeri Teman
dan Yang Mahakudus datang dari Gunung Paran.
Sela
", WrapTest("\\v 3 Allah datang dari negeri Teman \\q2 dan Yang Mahakudus datang dari Gunung Paran. \\qs Sela \\qs* ")); + Assert.AreEqual("3Allah datang dari negeri Teman
dan Yang Mahakudus datang dari Gunung Paran.
Sela
", WrapTest("\\v 3 Allah datang dari negeri Teman \\q2 dan Yang Mahakudus datang dari Gunung Paran. \\qs Sela \\qs* ")); Assert.AreEqual("
dan sampai batu yang penghabisan.
Sela
", WrapTest("\\q2 dan sampai batu yang penghabisan. \\qs Sela \\qs*")); // Transliterated - Assert.AreEqual("
111

1 10:15 DUNIA ORANG MATI: Dalam bahasa Yunani adalah Hades, tempat orang setelah meninggal.

", WrapTest("\\c 1 \\v 1 \\f + \\fr 10:15 \\fk dunia orang mati \\ft Dalam bahasa Yunani adalah \\tl Hades\\tl* \\ft , tempat orang setelah meninggal.\\f*")); - Assert.AreEqual("27TEKEL :", WrapTest("\\v 27 \\tl TEKEL\\tl* :")); + Assert.AreEqual("
111

1 10:15 DUNIA ORANG MATI: Dalam bahasa Yunani adalah Hades , tempat orang setelah meninggal.

", WrapTest("\\c 1 \\v 1 \\f + \\fr 10:15 \\fk dunia orang mati \\ft Dalam bahasa Yunani adalah \\tl Hades\\tl* \\ft , tempat orang setelah meninggal.\\f*")); + Assert.AreEqual("27TEKEL :", WrapTest("\\v 27 \\tl TEKEL\\tl* :")); } [TestMethod] @@ -108,7 +109,7 @@ public void TestTableRender() Assert.AreEqual("
dari suku Ruben12.000
", WrapTest("\\tr \\tc1 dari suku Ruben \\tcr2 12.000")); // Embedded Verse - Assert.AreEqual("6dari suku Asyer", WrapTest("\\tc1 \\v 6 dari suku Asyer")); + Assert.AreEqual("6dari suku Asyer", WrapTest("\\tc1 \\v 6 dari suku Asyer")); // Table Headers Assert.AreEqual("
dari suku Ruben12.000
", WrapTest("\\tr \\th1 dari suku Ruben \\thr2 12.000")); @@ -121,34 +122,34 @@ public void TestListRender() // List Items Assert.AreEqual("
Peres ayah Hezron.
", WrapTest("\\li Peres ayah Hezron.")); // Verse within List - Assert.AreEqual("
Peres ayah Hezron.
19Hezron ayah Ram.
", WrapTest("\\li Peres ayah Hezron. \\li \\v 19 Hezron ayah Ram.")); + Assert.AreEqual("
Peres ayah Hezron.
19Hezron ayah Ram.
", WrapTest("\\li Peres ayah Hezron. \\li \\v 19 Hezron ayah Ram.")); } [TestMethod] public void TestFootnoteRender() { // Footnote Caller - Text - Alternate Translation - Assert.AreEqual("26This is a footnote 1", WrapTest("\\v 26 This is a footnote \\f + \\f*")); - Assert.AreEqual("26God said, \"Let us make man in our image, after our likeness. Let them have dominion over the fish of the sea, over the birds of the sky, over the livestock, over all the earth, and over every creeping thing that creeps on the earth.\" 2", WrapTest("\\v 26 God said, \"Let us make man in our image, after our likeness. Let them have dominion over the fish of the sea, over the birds of the sky, over the livestock, over all the earth, and over every creeping thing that creeps on the earth.\" \\f + \\ft Some ancient copies have: \\fqa ... Over the livestock, over all the animals of the earth, and over every creeping thing that creeps on the earth \\fqa* . \\f*")); - Assert.AreEqual("1Sam Paul! 3", WrapTest("\\v 1 Sam Paul! \\f + \\ft Sample Simple Footnote. \\f*")); + Assert.AreEqual("26This is a footnote 1", WrapTest("\\v 26 This is a footnote \\f + \\f*")); + Assert.AreEqual("26God said, \"Let us make man in our image, after our likeness. Let them have dominion over the fish of the sea, over the birds of the sky, over the livestock, over all the earth, and over every creeping thing that creeps on the earth.\" 2", WrapTest("\\v 26 God said, \"Let us make man in our image, after our likeness. Let them have dominion over the fish of the sea, over the birds of the sky, over the livestock, over all the earth, and over every creeping thing that creeps on the earth.\" \\f + \\ft Some ancient copies have: \\fqa ... Over the livestock, over all the animals of the earth, and over every creeping thing that creeps on the earth \\fqa* . \\f*")); + Assert.AreEqual("1Sam Paul! 3", WrapTest("\\v 1 Sam Paul! \\f + \\ft Sample Simple Footnote. \\f*")); //Footnote Keyword - Reference - Verse Marker // Footnote Caller - Assert.AreEqual("
114

1
2Some ancient copies have: ... Over the livestock, over all the animals of the earth, and over every creeping thing that creeps on the earth .
3Sample Simple Footnote.
4Sample Simple Footnote.

", WrapTest("\\c 1 \\v 1 \\f + \\ft Sample Simple Footnote. \\f*")); + Assert.AreEqual("
114

1
2Some ancient copies have: ... Over the livestock, over all the animals of the earth, and over every creeping thing that creeps on the earth .
3Sample Simple Footnote.
4Sample Simple Footnote.

", WrapTest("\\c 1 \\v 1 \\f + \\ft Sample Simple Footnote. \\f*")); // Footnote Keyword SetUpTestCase(); // Reset content - Assert.AreEqual("
11

Sample Simple Footnote.

", WrapTest("\\c 1 \\v 1 \\f - \\ft Sample Simple Footnote. \\f*")); + Assert.AreEqual("
11

Sample Simple Footnote.

", WrapTest("\\c 1 \\v 1 \\f - \\ft Sample Simple Footnote. \\f*")); SetUpTestCase(); // Reset content - Assert.AreEqual("
11abc

abcSample Simple Footnote.

", WrapTest("\\c 1 \\v 1 \\f abc \\ft Sample Simple Footnote. \\f*")); + Assert.AreEqual("
11abc

abcSample Simple Footnote.

", WrapTest("\\c 1 \\v 1 \\f abc \\ft Sample Simple Footnote. \\f*")); // Footnote Keyword - Reference SetUpTestCase(); // Reset content - Assert.AreEqual("
111

1 1.3 TAMAR: Menantu Yehuda yang akhirnya menjadi istrinya (bc. Kej. 38:1-30).

", WrapTest("\\c 1 \\v 1 \\f + \\fr 1.3 \\fk Tamar \\ft Menantu Yehuda yang akhirnya menjadi istrinya (bc. Kej. 38:1-30).\\f*")); + Assert.AreEqual("
111

1 1.3 TAMAR: Menantu Yehuda yang akhirnya menjadi istrinya (bc. Kej. 38:1-30).

", WrapTest("\\c 1 \\v 1 \\f + \\fr 1.3 \\fk Tamar \\ft Menantu Yehuda yang akhirnya menjadi istrinya (bc. Kej. 38:1-30).\\f*")); // Footnote Verse Marker - Paragraph SetUpTestCase(); // Reset content - Assert.AreEqual("
111

1 9:55 Beberapa 56untuk menyelamatkan mereka.

", WrapTest("\\c 1 \\v 1 \\f + \\fr 9:55 \\ft Beberapa \\fv 56 \\ft untuk menyelamatkan mereka.\\f*")); + Assert.AreEqual("
111

1 9:55 Beberapa 56untuk menyelamatkan mereka.

", WrapTest("\\c 1 \\v 1 \\f + \\fr 9:55 \\ft Beberapa \\fv 56 \\ft untuk menyelamatkan mereka.\\f*")); } [TestMethod] @@ -158,46 +159,46 @@ public void TestCrossReferenceRender() Assert.AreEqual("", WrapTest("\\x - \\xo 11.21 \\xq Tebes \\xt \\x*")); // Cross Reference Origin - Assert.AreEqual("
11

11.21 Tebes 11.21 Tebes ", WrapTest("\\c 1 \\v 1 \\x - \\xo 11.21 \\xq Tebes \\xt \\x*")); + Assert.AreEqual("
11

11.21 Tebes 11.21 Tebes ", WrapTest("\\c 1 \\v 1 \\x - \\xo 11.21 \\xq Tebes \\xt \\x*")); // Cross Reference Target - Assert.AreEqual("
11

11.21 TebesMrk 1.24; Luk 2.39; Jhn 1.45. ", WrapTest("\\c 1 \\v 1 \\x - \\xo 11.21 \\xq Tebes \\xt Mrk 1.24; Luk 2.39; Jhn 1.45.\\x*")); + Assert.AreEqual("
11

11.21 TebesMrk 1.24; Luk 2.39; Jhn 1.45. ", WrapTest("\\c 1 \\v 1 \\x - \\xo 11.21 \\xq Tebes \\xt Mrk 1.24; Luk 2.39; Jhn 1.45.\\x*")); // Cross Reference Quotation - Assert.AreEqual("
11

11.21 Tebes ", WrapTest("\\c 1 \\v 1 \\x - \\xo 11.21 \\xq Tebes \\xt \\x*")); + Assert.AreEqual("
11

11.21 Tebes ", WrapTest("\\c 1 \\v 1 \\x - \\xo 11.21 \\xq Tebes \\xt \\x*")); } [TestMethod] public void TestVPRender() { - Assert.AreEqual("1a This is not Scripture", WrapTest("\\v 1 \\vp 1a \\vp* This is not Scripture")); - Assert.AreEqual("2b This is not Scripture", WrapTest("\\v 2 \\vp 2b \\vp* This is not Scripture")); + Assert.AreEqual("1a This is not Scripture", WrapTest("\\v 1 \\vp 1a \\vp* This is not Scripture")); + Assert.AreEqual("2b This is not Scripture", WrapTest("\\v 2 \\vp 2b \\vp* This is not Scripture")); } [TestMethod] public void TestWordEntryRender() { // Within Footnotes - Assert.AreEqual("
111

1 3:5 BERHALA: Lih. Berhala di Daftar Istilah.

" , WrapTest("\\c 1 \\v 1\\f + \\fr 3:5 \\fk berhala \\ft Lih. \\w Berhala \\w* di Daftar Istilah.\\f*")); + Assert.AreEqual("
111

1 3:5 BERHALA: Lih. Berhala di Daftar Istilah.

" , WrapTest("\\c 1 \\v 1\\f + \\fr 3:5 \\fk berhala \\ft Lih. \\w Berhala \\w* di Daftar Istilah.\\f*")); // Word Entry Attributes - Assert.AreEqual("1 Berhala di Daftar Istilah", WrapTest("\\v 1 \\w Berhala|Berhala \\w* di Daftar Istilah")); - Assert.AreEqual("1 gracious di Daftar Istilah.", WrapTest("\\v 1 \\w gracious|lemma=\"grace\" \\w* di Daftar Istilah.")); - Assert.AreEqual("1 gracious di Daftar Istilah.", WrapTest("\\v 1 \\w gracious|lemma=\"grace\" strong=\"G5485\" \\w* di Daftar Istilah.")); - Assert.AreEqual("1 gracious di Daftar Istilah.", WrapTest("\\v 1 \\w gracious|strong=\"H1234,G5485\" \\w* di Daftar Istilah.")); - Assert.AreEqual("1 gracious di Daftar Istilah.", WrapTest("\\v 1 \\w gracious|lemma=\"grace\" srcloc=\"gnt5:51.1.2.1\" \\w* di Daftar Istilah.")); + Assert.AreEqual("1 Berhala di Daftar Istilah", WrapTest("\\v 1 \\w Berhala|Berhala \\w* di Daftar Istilah")); + Assert.AreEqual("1 gracious di Daftar Istilah.", WrapTest("\\v 1 \\w gracious|lemma=\"grace\" \\w* di Daftar Istilah.")); + Assert.AreEqual("1 gracious di Daftar Istilah.", WrapTest("\\v 1 \\w gracious|lemma=\"grace\" strong=\"G5485\" \\w* di Daftar Istilah.")); + Assert.AreEqual("1 gracious di Daftar Istilah.", WrapTest("\\v 1 \\w gracious|strong=\"H1234,G5485\" \\w* di Daftar Istilah.")); + Assert.AreEqual("1 gracious di Daftar Istilah.", WrapTest("\\v 1 \\w gracious|lemma=\"grace\" srcloc=\"gnt5:51.1.2.1\" \\w* di Daftar Istilah.")); } [TestMethod] public void TestCharacterStylingRender() { - Assert.AreEqual("21Penduduk kota yang satu akan pergi Emphasis", WrapTest("\\v 21 Penduduk kota yang satu akan pergi \\em Emphasis \\em* ")); - Assert.AreEqual("21Penduduk kota yang satu akan pergi Boldness", WrapTest("\\v 21 Penduduk kota yang satu akan pergi \\bd Boldness \\bd* ")); - Assert.AreEqual("21Penduduk kota yang satu akan pergi Boldness and Italics", WrapTest("\\v 21 Penduduk kota yang satu akan pergi \\bdit Boldness and Italics \\bdit* ")); - Assert.AreEqual("21Penduduk kota yang satu akan pergi Italics", WrapTest("\\v 21 Penduduk kota yang satu akan pergi \\it Italics \\it* ")); - Assert.AreEqual("21Penduduk kota yang satu akan pergi Superscript", WrapTest("\\v 21 Penduduk kota yang satu akan pergi \\sup Superscript \\sup* ")); - Assert.AreEqual("21Penduduk kota yang satu akan pergi Name of Diety", WrapTest("\\v 21 Penduduk kota yang satu akan pergi \\nd Name of Diety \\nd* ")); - Assert.AreEqual("21Penduduk kota yang satu akan pergi Small Caps", WrapTest("\\v 21 Penduduk kota yang satu akan pergi \\sc Small Caps \\sc* ")); - Assert.AreEqual("21Penduduk kota yang satu akan pergi Normal", WrapTest("\\v 21 Penduduk kota yang satu akan pergi \\no Normal \\no* ")); + Assert.AreEqual("21Penduduk kota yang satu akan pergi Emphasis", WrapTest("\\v 21 Penduduk kota yang satu akan pergi \\em Emphasis \\em* ")); + Assert.AreEqual("21Penduduk kota yang satu akan pergi Boldness", WrapTest("\\v 21 Penduduk kota yang satu akan pergi \\bd Boldness \\bd* ")); + Assert.AreEqual("21Penduduk kota yang satu akan pergi Boldness and Italics", WrapTest("\\v 21 Penduduk kota yang satu akan pergi \\bdit Boldness and Italics \\bdit* ")); + Assert.AreEqual("21Penduduk kota yang satu akan pergi Italics", WrapTest("\\v 21 Penduduk kota yang satu akan pergi \\it Italics \\it* ")); + Assert.AreEqual("21Penduduk kota yang satu akan pergi Superscript", WrapTest("\\v 21 Penduduk kota yang satu akan pergi \\sup Superscript \\sup* ")); + Assert.AreEqual("21Penduduk kota yang satu akan pergi Name of Diety", WrapTest("\\v 21 Penduduk kota yang satu akan pergi \\nd Name of Diety \\nd* ")); + Assert.AreEqual("21Penduduk kota yang satu akan pergi Small Caps", WrapTest("\\v 21 Penduduk kota yang satu akan pergi \\sc Small Caps \\sc* ")); + Assert.AreEqual("21Penduduk kota yang satu akan pergi Normal", WrapTest("\\v 21 Penduduk kota yang satu akan pergi \\no Normal \\no* ")); } @@ -205,9 +206,9 @@ public void TestCharacterStylingRender() public void TestStyleRender() { render.ConfigurationHTML.divClasses.Add("two-columns"); - Assert.AreEqual("
200Genesis
", WrapTest("\\v 200 Genesis")); + Assert.AreEqual("
200Genesis
", WrapTest("\\v 200 Genesis")); render.ConfigurationHTML.divClasses.Add("justified"); - Assert.AreEqual("
200Genesis
", WrapTest("\\v 200 Genesis")); + Assert.AreEqual("
200Genesis
", WrapTest("\\v 200 Genesis")); } [TestMethod] @@ -216,7 +217,7 @@ public void TestChapterBreak() render.ConfigurationHTML.separateChapters = true; Assert.AreEqual("
Genesis
1


2


3


", WrapTest("\\mt Genesis \\c 1 \\c 2 \\c 3")); Assert.AreEqual("
Genesis
1


2


Exodus
1


", WrapTest("\\mt Genesis \\c 1 \\c 2 \\mt Exodus \\c 1")); - Assert.AreEqual("
11First


21Second


31Third


", WrapTest("\\c 1 \\v 1 First \\c 2 \\v 1 Second \\c 3 \\v 1 Third")); + Assert.AreEqual("
11First


21Second


31Third


", WrapTest("\\c 1 \\v 1 First \\c 2 \\v 1 Second \\c 3 \\v 1 Third")); } [TestMethod] @@ -224,7 +225,7 @@ public void TestBlankColumn() { render.ConfigurationHTML.blankColumn = true; - Assert.AreEqual("
11First 2Second 3Third
", WrapTest("\\c 1 \\v 1 First \\v 2 Second \\v 3 Third")); + Assert.AreEqual("
11First 2Second 3Third
", WrapTest("\\c 1 \\v 1 First \\v 2 Second \\v 3 Third")); } [TestMethod] public void TestUnknownMarkerRender() @@ -261,9 +262,9 @@ public void TestNestedPoetryRender() "\\q1 \\v 12 Verse twelve text.\n" + "\\q2 \\v 13 Verse thirteen text.\n"; - var expectedFromAcendingNested = "
12Verse twelve text lv1
verse twelve text lv2
verse twelve text lv3.
"; - var expectedFromDescendingNested = "
12Verse twelve text lv2
verse twelve text lv1.
"; - var expectedFromNonNested = "
12Verse twelve text.
13Verse thirteen text.
"; + var expectedFromAcendingNested = "
12Verse twelve text lv1
verse twelve text lv2
verse twelve text lv3.
"; + var expectedFromDescendingNested = "
12Verse twelve text lv2
verse twelve text lv1.
"; + var expectedFromNonNested = "
12Verse twelve text.
13Verse thirteen text.
"; Assert.AreEqual(expectedFromAcendingNested, WrapTest(ascendingNested)); Assert.AreEqual(expectedFromDescendingNested, WrapTest(descendingNested)); diff --git a/USFMToolsSharp.Renderers.HTML/HtmlRenderer.cs b/USFMToolsSharp.Renderers.HTML/HtmlRenderer.cs index a6bde9f..2322947 100644 --- a/USFMToolsSharp.Renderers.HTML/HtmlRenderer.cs +++ b/USFMToolsSharp.Renderers.HTML/HtmlRenderer.cs @@ -44,6 +44,7 @@ public string Render(USFMDocument input) var encoding = GetEncoding(input); StringBuilder output = new StringBuilder(); NextFootnoteUniqueID = 1; + CurrentChapter = null; if (!ConfigurationHTML.partialHTML) { @@ -189,7 +190,14 @@ private string RenderMarker(Marker input) break; case VMarker vMarker: CurrentVerse = vMarker; - output.AppendLine($""); + if (CurrentChapter != null) + { + output.AppendLine($""); + } + else + { + output.AppendLine($""); + } output.AppendLine($"{vMarker.VerseCharacter}"); foreach(Marker marker in input.Contents) { diff --git a/USFMToolsSharp.Renderers.HTML/USFMToolsSharp.Renderers.HTML.csproj b/USFMToolsSharp.Renderers.HTML/USFMToolsSharp.Renderers.HTML.csproj index b602199..9bbe317 100644 --- a/USFMToolsSharp.Renderers.HTML/USFMToolsSharp.Renderers.HTML.csproj +++ b/USFMToolsSharp.Renderers.HTML/USFMToolsSharp.Renderers.HTML.csproj @@ -1,25 +1,25 @@ - - - - netstandard1.0 - true - 0.4.0 - @rbnswartz; @BryanHo10 - Wycliffe Associates - LICENSE - https://github.com/WycliffeAssociates/USFMToolsSharp.Renderers.HTML - https://github.com/WycliffeAssociates/USFMToolsSharp.Renderers.HTML - - - - - True - - - - - - - - - + + + + netstandard1.0 + true + 0.4.0 + @rbnswartz; @BryanHo10 + Wycliffe Associates + LICENSE + https://github.com/WycliffeAssociates/USFMToolsSharp.Renderers.HTML + https://github.com/WycliffeAssociates/USFMToolsSharp.Renderers.HTML + + + + + True + + + + + + + + + From 042b12684fde4891c97ff5daeecaae440ca346cf Mon Sep 17 00:00:00 2001 From: Reuben Swartz Date: Wed, 22 Jun 2022 16:48:50 -0400 Subject: [PATCH 2/2] Added CI/CD --- .github/workflows/dotnet.yml | 33 +++++++++++++++++++++++++++++++++ .github/workflows/pr.yml | 19 +++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 .github/workflows/dotnet.yml create mode 100644 .github/workflows/pr.yml diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml new file mode 100644 index 0000000..6e34aa6 --- /dev/null +++ b/.github/workflows/dotnet.yml @@ -0,0 +1,33 @@ +name: .NET build, test, nuget push + +on: + push: + branches: [ master ] + tags: + - "*" + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Setup .NET + uses: actions/setup-dotnet@v2 + with: + dotnet-version: 3.1.x + - name: Restore dependencies + run: dotnet restore + - name: Build + run: dotnet build --no-restore -c Release + - name: Test + run: dotnet test -c Release + - name: Push to Nuget if tagged + if: contains( github.ref, 'refs/tags/v' ) + run: | + cd ./USFMToolsSharp.Renderers.Docx/bin/Release/ && \ + PKG_NAME=$(ls *.nupkg) && \ + dotnet nuget push $PKG_NAME -k $NUGET_TOKEN -s https://api.nuget.org/v3/index.json + env: + NUGET_TOKEN: ${{ secrets.NUGET_TOKEN }} diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 0000000..c1626ca --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,19 @@ +name: PR Build + +on: [ pull_request ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Setup .NET + uses: actions/setup-dotnet@v2 + with: + dotnet-version: 3.1.x + - name: Build + run: dotnet build -c Release + - name: Test + run: dotnet test -c Release \ No newline at end of file