|
| 1 | +name: Build |
| 2 | + |
| 3 | +on: |
| 4 | + create: |
| 5 | + tags: |
| 6 | + - 'v*.*.*' |
| 7 | + |
| 8 | +jobs: |
| 9 | + setup: |
| 10 | + name: Setup |
| 11 | + runs-on: ubuntu-latest |
| 12 | + steps: |
| 13 | + - name: Checkout project |
| 14 | + id: checkout |
| 15 | + uses: actions/checkout@v2 |
| 16 | + with: |
| 17 | + fetch-depth: 0 |
| 18 | + |
| 19 | + - name: Cache src |
| 20 | + id: cache-src |
| 21 | + uses: actions/upload-artifact@v2 |
| 22 | + with: |
| 23 | + name: repo |
| 24 | + path: ./* |
| 25 | + |
| 26 | + build_arm64v8: |
| 27 | + needs: setup |
| 28 | + name: build for arm64v8 |
| 29 | + runs-on: ubuntu-latest |
| 30 | + steps: |
| 31 | + - uses: actions/download-artifact@v2 |
| 32 | + with: |
| 33 | + name: repo |
| 34 | + path: ./ |
| 35 | + |
| 36 | + - name: Setup |
| 37 | + run: | |
| 38 | + chmod +wr . -R |
| 39 | + chmod +x ./scripts/*.sh |
| 40 | + chmod +x ./scripts/*.pl |
| 41 | +
|
| 42 | + - name: Set up QEMU |
| 43 | + uses: docker/setup-qemu-action@v1 |
| 44 | + |
| 45 | + - name: Set up Docker Buildx |
| 46 | + uses: docker/setup-buildx-action@v1 |
| 47 | + |
| 48 | + - name: Build in Docker |
| 49 | + id: build |
| 50 | + run: | |
| 51 | + docker buildx build --platform linux/arm64 -t 4tqrgqe5yrgfd/figma-linux-artefacts-arm --load -f ./docker/Build_artefacts_arm64v8 . |
| 52 | + mkdir -p ./build/installers |
| 53 | + docker cp $(docker create 4tqrgqe5yrgfd/figma-linux-artefacts-arm)://usr/src/figma-linux/build/installers/. ./build/installers |
| 54 | + perl ./scripts/generate_release_notes.pl |
| 55 | +
|
| 56 | + - name: Cache arm64v8 artifacts |
| 57 | + id: cache-arm64v8-artifacts |
| 58 | + uses: actions/upload-artifact@v2 |
| 59 | + with: |
| 60 | + name: arm64v8 |
| 61 | + path: build/installers/* |
| 62 | + |
| 63 | + release_arm64v8: |
| 64 | + name: Upload assets |
| 65 | + runs-on: ubuntu-latest |
| 66 | + needs: build_arm64v8 |
| 67 | + steps: |
| 68 | + - name: mkdir installers |
| 69 | + run: mkdir -p ./build/installers |
| 70 | + |
| 71 | + - uses: actions/download-artifact@v2 |
| 72 | + with: |
| 73 | + name: arm64v8 |
| 74 | + path: ./build/installers |
| 75 | + |
| 76 | + - name: Get version |
| 77 | + id: version |
| 78 | + run: | |
| 79 | + echo ::set-output name=release::$(cat build/installers/version) |
| 80 | +
|
| 81 | + - name: Upload release assets |
| 82 | + id: release |
| 83 | + uses: softprops/action-gh-release@v1 |
| 84 | + if: startsWith(github.ref, 'refs/tags/') |
| 85 | + with: |
| 86 | + name: Figma Linux ${{ steps.version.outputs.release }} |
| 87 | + files: build/installers/figma-linux* |
| 88 | + env: |
| 89 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 90 | + |
| 91 | + build_amd64: |
| 92 | + runs-on: ubuntu-latest |
| 93 | + name: build for amd64 |
| 94 | + needs: setup |
| 95 | + steps: |
| 96 | + - uses: actions/download-artifact@v2 |
| 97 | + with: |
| 98 | + name: repo |
| 99 | + path: ./ |
| 100 | + |
| 101 | + - name: Setup |
| 102 | + run: | |
| 103 | + chmod +wr . -R |
| 104 | + chmod +x ./scripts/*.sh |
| 105 | + chmod +x ./scripts/*.pl |
| 106 | +
|
| 107 | + - name: Build in Docker |
| 108 | + id: build |
| 109 | + run: | |
| 110 | + docker build -t figma-linux-artefacts -f "./docker/Build_artefacts_local" . |
| 111 | + mkdir -p ./build/installers |
| 112 | + docker cp $(docker create figma-linux-artefacts:latest)://usr/src/figma-linux/build/installers/. ./build/installers |
| 113 | + perl ./scripts/generate_release_notes.pl |
| 114 | +
|
| 115 | + - name: Cache amd64 artifacts |
| 116 | + id: cache-amd64-artifacts |
| 117 | + uses: actions/upload-artifact@v2 |
| 118 | + with: |
| 119 | + name: amd64 |
| 120 | + path: | |
| 121 | + ./release_notes |
| 122 | + build/installers/* |
| 123 | +
|
| 124 | + release_amd64: |
| 125 | + name: Upload assets |
| 126 | + runs-on: ubuntu-latest |
| 127 | + needs: build_amd64 |
| 128 | + steps: |
| 129 | + - name: mkdir installers |
| 130 | + run: mkdir -p ./build/installers |
| 131 | + |
| 132 | + - uses: actions/download-artifact@v2 |
| 133 | + with: |
| 134 | + name: amd64 |
| 135 | + path: ./ |
| 136 | + |
| 137 | + - name: Get version |
| 138 | + id: version |
| 139 | + run: | |
| 140 | + echo ::set-output name=release::$(cat build/installers/version) |
| 141 | +
|
| 142 | + - name: Upload release assets |
| 143 | + id: release |
| 144 | + uses: softprops/action-gh-release@v1 |
| 145 | + if: startsWith(github.ref, 'refs/tags/') |
| 146 | + with: |
| 147 | + body_path: ./release_notes |
| 148 | + name: Figma Linux ${{ steps.version.outputs.release }} |
| 149 | + files: build/installers/figma-linux* |
| 150 | + env: |
| 151 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 152 | + |
| 153 | + upload_ppa_amd64: |
| 154 | + name: Upload to Launchpad PPA |
| 155 | + runs-on: ubuntu-latest |
| 156 | + needs: build_amd64 |
| 157 | + steps: |
| 158 | + - uses: actions/download-artifact@v2 |
| 159 | + with: |
| 160 | + path: ./ |
| 161 | + |
| 162 | + - name: Import keys |
| 163 | + run: | |
| 164 | + ls -la . |
| 165 | + mv ./repo/* ./ |
| 166 | + mv ./amd64/* ./ |
| 167 | + rm -rf ./repo |
| 168 | + rm -rf ./amd64 |
| 169 | + ls -la . |
| 170 | + chmod +x ./scripts/* |
| 171 | + ls -la ./scripts |
| 172 | + ls -la ./build |
| 173 | + ls -la ./build/installers |
| 174 | + mkdir ./gpg |
| 175 | + echo "${{ secrets.GPG_PUB_KEY }}" | base64 -d > ./gpg/pub.key |
| 176 | + echo "${{ secrets.GPG_SECRET_KEY }}" | base64 -d > ./gpg/secret.key |
| 177 | + echo "${{ secrets.GPG_PASSPHRASE_KEY }}" | base64 -d > ./gpg/passphrase |
| 178 | + echo "${{ secrets.ID_RSA }}" | base64 -d > ./gpg/id_rsa |
| 179 | +
|
| 180 | + - name: Login to DockerHub |
| 181 | + uses: docker/login-action@v1 |
| 182 | + with: |
| 183 | + username: ${{ secrets.DOCKER_USERNAME }} |
| 184 | + password: ${{ secrets.DOCKER_PASSWORD }} |
| 185 | + |
| 186 | + - name: Build and Upload PPA |
| 187 | + run: | |
| 188 | + ./scripts/build_ppa.sh |
0 commit comments