summaryrefslogtreecommitdiff
path: root/.github/workflows/release_ubuntu.yml
blob: edfd4993bbab3446998e49c9673ee25ea1b2c104 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
name: Auto release of eSim for Ubuntu OS

on:
  push:
    tags:
      - 'v*' # Push events to matching v*, i.e. v2.2, v2.3 etc
  workflow_dispatch:


jobs:
  release_eSim:
    runs-on: ubuntu-latest
    steps:


# Create eSim release directory
      - name: Preparing eSim for release
        run: mkdir /home/runner/work/eSim_release


# Steps to prepare nghld.zip 
      - name: Preparing nghdl for release
        run: mkdir /home/runner/work/nghdl_release

      - name: Checkout FOSSEE/nghdl installers branch
        uses: actions/checkout@v3
        with:
          repository: FOSSEE/nghdl
          ref: installers
      
      - name: Get required data from the nghld/installers branch
        run: |
          cp Ubuntu/ghdl-*.tar.xz /home/runner/work/nghdl_release/.
          cp Ubuntu/verilator-*.tar.xz /home/runner/work/nghdl_release/.
          cp Ubuntu/install-nghdl.sh /home/runner/work/nghdl_release/.

      - name: Checkout FOSSEE/nghdl installers branch
        uses: actions/checkout@v3
        with:
          repository: FOSSEE/nghdl
          ref: master

      - name: Get required data from the nghld/master branch
        run: |
          cp -rf ./* /home/runner/work/nghdl_release/.
          cd /home/runner/work
          rm -rf nghdl_release/.git* nghdl_release/*.md 

      - name: Compress the nghdl folder and copy it to eSim release folder
        run: |
          zip -r nghld.zip . -i nghdl_release/.
          cp nghld.zip /home/runner/work/eSim_release/.
          tree /home/runner/work/


# Steps to prepare eSim release directory
      - name: Checkout FOSSEE/eSim master branch
        uses: actions/checkout@v3
        with:
          repository: FOSSEE/eSim
          ref: master

      - name: Compress the library/kicadLibrary folder
        run: |
          tar cfJ kicadLibrary.tar.xz library/kicadLibrary/.
          cp kicadLibrary.tar.xz /home/runner/work/eSim_release/.

      - name: Copy all the data from eSim/master to eSim_release and delete specific data
        run: |
          rm -rf .git* code library/browser/User-Manual/figures
          rm conf.py setup.py index.rst requirements.txt .travis.yml library/browser/User-Manual/eSim.html
          cp -rf ./* /home/runner/work/eSim_release/.

      - name: Checkout FOSSEE/eSim installers branch
        uses: actions/checkout@v3
        with:
          repository: FOSSEE/eSim
          ref: installers

      - name: Copy install-eSim.sh script to the release directory
        run: |
          cp Ubuntu/install-eSim.sh /home/runner/work/eSim_release/.

      # extract the number from the tag to pull the relevant manual from the website
      - name: Copy eSim manual which is available at https://static.fossee.in/esim/manuals/
        run: |
          echo "version=$(echo ${{github.ref_name}} | cut -d 'v' -f 2)" >> $GITHUB_ENV
          wget https://static.fossee.in/esim/manuals/eSim_Manual_${{ env.version }}.pdf

      - name: Zip the eSim_release folder
        run: |
          cd /home/runner/work/
          zip -r eSim_release.zip eSim_release/


# Create a release and upload artifact
      - name: Create Release
        id: create_release
        uses: actions/create-release@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          tag_name: ${{ github.ref_name }}
          release_name: ${{ github.ref_name }}
          draft: false
          prerelease: false

      - name: Upload Release Asset
        id: upload-release-asset 
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps 
          asset_path: /home/runner/work/eSim_release.zip
          asset_name: eSim_release.zip
          asset_content_type: application/zip