Răsfoiți Sursa

update github actions (#158)

add a release dev

Co-authored-by: Fred Lefévère-Laoide <Fred.Lefevere-Laoide@Taipy.io>
Fred Lefévère-Laoide 2 ani în urmă
părinte
comite
d076a69ce8

+ 1 - 1
.github/workflows/linter.yml

@@ -15,7 +15,7 @@ jobs:
         language: [ 'python' ]
     runs-on: ubuntu-latest
     steps:
-      - uses: actions/checkout@v1
+      - uses: actions/checkout@v3
       - uses: ricardochaves/python-lint@v1.4.0
         with:
           use-pylint: false

+ 2 - 2
.github/workflows/packaging.yml

@@ -23,8 +23,8 @@ jobs:
     runs-on: ${{ matrix.os }}
 
     steps:
-      - uses: actions/checkout@v2
-      - uses: actions/setup-python@v2
+      - uses: actions/checkout@v3
+      - uses: actions/setup-python@v4
         with:
           python-version: ${{ matrix.python-versions }}
 

+ 5 - 5
.github/workflows/publish.yml

@@ -12,14 +12,14 @@ jobs:
     timeout-minutes: 20
     runs-on: ubuntu-latest
     steps:
-      - uses: actions/checkout@v2
-      - uses: actions/setup-python@v2
+      - uses: actions/checkout@v3
+      - uses: actions/setup-python@v4
         with:
           python-version: 3.8
 
       - name: Extract branch name
         shell: bash
-        run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
+        run: echo "branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT
         id: extract_branch
 
       - name: Ensure package version is properly set
@@ -68,8 +68,8 @@ jobs:
     environment: publish
     runs-on: ubuntu-latest
     steps:
-      - uses: actions/checkout@v2
-      - uses: actions/setup-python@v2
+      - uses: actions/checkout@v3
+      - uses: actions/setup-python@v4
         with:
           python-version: 3.8
 

+ 61 - 0
.github/workflows/release-dev.yml

@@ -0,0 +1,61 @@
+name: Publish pre-release to github
+
+on:
+  workflow_dispatch:
+    inputs:
+      version:
+        description: "The package version to create (ex: 1.0.0)"
+        required: true
+
+jobs:
+  check-package-version:
+    timeout-minutes: 20
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v3
+      - uses: actions/setup-python@v4
+        with:
+          python-version: 3.8
+
+      - name: Ensure package version is properly set
+        run: |
+            echo """
+            import json, sys, os
+            with open(f\"src{os.sep}taipy{os.sep}version.json\") as version_file:
+                version_o = json.load(version_file)
+            version = f'{version_o.get(\"major\")}.{version_o.get(\"minor\")}.{version_o.get(\"patch\")}'
+            if vext := version_o.get(\"ext\"):
+                version = f'{version}.{vext}'
+            if version != sys.argv[1]:
+                raise ValueError(f\"Invalid version {version} / {sys.argv[1]}\")
+            """ > /tmp/check1.py
+            python /tmp/check1.py "${{ github.event.inputs.version }}"
+
+  publish:
+    needs: [check-package-version]
+    timeout-minutes: 20
+    environment: publish
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v3
+      - uses: actions/setup-python@v4
+        with:
+          python-version: 3.8
+      - uses: actions/setup-node@v3
+        with:
+          node-version: '18'
+
+      - name: Install dependencies
+        run: |
+            python -m pip install --upgrade pip
+            pip install build
+
+      - name: Build package
+        run: python setup.py build_py && python -m build
+
+      - name: Create/update release and tag
+        run: |
+            gh release delete dev-${{ github.event.inputs.version }} -y || true
+            gh release create dev-${{ github.event.inputs.version }} ./dist/taipy-${{ github.event.inputs.version }}.tar.gz --draft --prerelease --notes "Release Draft ${{ github.event.inputs.version }}"
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

+ 6 - 6
.github/workflows/release.yml

@@ -12,14 +12,14 @@ jobs:
     timeout-minutes: 20
     runs-on: ubuntu-latest
     steps:
-      - uses: actions/checkout@v2
-      - uses: actions/setup-python@v2
+      - uses: actions/checkout@v3
+      - uses: actions/setup-python@v4
         with:
           python-version: 3.8
 
       - name: Extract branch name
         shell: bash
-        run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
+        run: echo "branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT
         id: extract_branch
 
       - name: Ensure package version is properly set
@@ -68,15 +68,15 @@ jobs:
     runs-on: ubuntu-latest
 
     steps:
-      - uses: actions/checkout@v2
+      - uses: actions/checkout@v3
 
       - name: Extract commit hash
         shell: bash
-        run: echo "##[set-output name=hash;]$(echo $(git rev-parse HEAD))"
+        run: echo "HASH=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
         id: extract_hash
 
       - name: Create/update release and tag
         run: |
-            gh release create ${{ github.event.inputs.version }} --target ${{ steps.extract_hash.outputs.hash }} --title ${{ github.event.inputs.version }}
+            gh release create ${{ github.event.inputs.version }} --target ${{ steps.extract_hash.outputs.HASH }} --title ${{ github.event.inputs.version }}
         env:
           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

+ 2 - 2
.github/workflows/tests.yml

@@ -16,8 +16,8 @@ jobs:
     runs-on: ${{ matrix.os }}
 
     steps:
-      - uses: actions/checkout@v2
-      - uses: actions/setup-python@v2
+      - uses: actions/checkout@v3
+      - uses: actions/setup-python@v4
         with:
           python-version: ${{ matrix.python-versions }}