diff --git a/.github/workflows/alpha-release.yml b/.github/workflows/alpha-release.yml index 9e32f04c..61abfbc7 100644 --- a/.github/workflows/alpha-release.yml +++ b/.github/workflows/alpha-release.yml @@ -11,19 +11,20 @@ jobs: create-tag: runs-on: ubuntu-latest outputs: - tagname: ${{ steps.create_tag.outputs.tagname }} - + tagname: ${{ steps.get_tag.outputs.tagname }} steps: - name: Checkout code uses: actions/checkout@v4 - - name: Create Tag - id: create_tag - uses: Klemensas/action-autotag@stable + - name: Get tag from package.json + id: get_tag + run: | + VERSION=$(npm run version --silent) + echo "tagname=v${VERSION}-alpha.${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT + + - uses: rickstaa/action-create-tag@v1 with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - tag_prefix: 'v' - tag_suffix: '-alpha.${{ github.event.inputs.tag }}' + tag: ${{ steps.get_tag.outputs.tagname }} build-worker: runs-on: ubuntu-latest @@ -144,25 +145,21 @@ jobs: name: cli path: cli + - name: Rename CLI + run: | + mv cli/bin/cli-x64 ./runtipi-cli-linux-x64 + - name: Create alpha release id: create_release - uses: actions/create-release@v1 + uses: softprops/action-gh-release@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: body: | **${{ needs.create-tag.outputs.tagname }}** tag_name: ${{ needs.create-tag.outputs.tagname }} - release_name: ${{ needs.create-tag.outputs.tagname }} + name: ${{ needs.create-tag.outputs.tagname }} draft: false prerelease: true - - - name: Upload X64 Linux CLI binary to release - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: cli/bin/cli-x64 - asset_name: runtipi-cli-linux-x64 - asset_content_type: application/octet-stream + files: | + runtipi-cli-linux-x64 diff --git a/.github/workflows/beta-release.yml b/.github/workflows/beta-release.yml index 42a880d6..4b8d8cbe 100644 --- a/.github/workflows/beta-release.yml +++ b/.github/workflows/beta-release.yml @@ -11,18 +11,20 @@ jobs: create-tag: runs-on: ubuntu-latest outputs: - tagname: ${{ steps.create_tag.outputs.tagname }} + tagname: ${{ steps.get_tag.outputs.tagname }} steps: - name: Checkout code uses: actions/checkout@v4 - - name: Create Tag - id: create_tag - uses: Klemensas/action-autotag@stable + - name: Get tag from package.json + id: get_tag + run: | + VERSION=$(npm run version --silent) + echo "tagname=v${VERSION}-beta.${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT + + - uses: rickstaa/action-create-tag@v1 with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - tag_prefix: 'v' - tag_suffix: '-beta.${{ github.event.inputs.tag }}' + tag: ${{ steps.get_tag.outputs.tagname }} build-worker: runs-on: ubuntu-latest @@ -144,38 +146,26 @@ jobs: name: cli path: cli + - name: Rename CLI + run: | + mv cli/bin/cli-x64 ./runtipi-cli-linux-x64 + mv cli/bin/cli-arm64 ./runtipi-cli-linux-arm64 + - name: Create beta release id: create_release - uses: actions/create-release@v1 + uses: softprops/action-gh-release@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: body: | **${{ needs.create-tag.outputs.tagname }}** tag_name: ${{ needs.create-tag.outputs.tagname }} - release_name: ${{ needs.create-tag.outputs.tagname }} + name: ${{ needs.create-tag.outputs.tagname }} draft: false prerelease: true - - - name: Upload X64 Linux CLI binary to release - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: cli/bin/cli-x64 - asset_name: runtipi-cli-linux-x64 - asset_content_type: application/octet-stream - - - name: Upload ARM64 Linux CLI binary to release - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: cli/bin/cli-arm64 - asset_name: runtipi-cli-linux-arm64 - asset_content_type: application/octet-stream + files: | + runtipi-cli-linux-x64 + runtipi-cli-linux-arm64 e2e-tests: needs: [create-tag, publish-release] diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index dc9d23d5..32985ce2 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -72,9 +72,6 @@ jobs: run: | while ! ssh -o StrictHostKeyChecking=no -i ~/.ssh/id_rsa root@${{ steps.get-droplet-ip.outputs.droplet_ip }} "echo 'SSH is ready'"; do sleep 5; done - - name: Wait 1 minute for Droplet to be ready - run: sleep 60 - - name: Create docker group on Droplet uses: fifsky/ssh-action@master with: @@ -85,6 +82,10 @@ jobs: user: root key: ${{ secrets.SSH_KEY }} + - name: Wait for dpkg lock to be released + run: | + while ! ssh -o StrictHostKeyChecking=no -i ~/.ssh/id_rsa root@${{ steps.get-droplet-ip.outputs.droplet_ip }} "dpkg --configure -a"; do sleep 5; done + - name: Deploy app to Droplet uses: fifsky/ssh-action@master with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fe6723b6..1a94fdef 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,28 +3,28 @@ on: workflow_dispatch: jobs: - get-tag: + create-tag: runs-on: ubuntu-latest + needs: [build-images, build-cli] outputs: - tag: ${{ steps.get_tag.outputs.tag }} + tagname: ${{ steps.get_tag.outputs.tagname }} steps: - name: Checkout code uses: actions/checkout@v4 - - name: Install Node.js - uses: actions/setup-node@v4 - with: - node-version: 18 - - - name: Get tag from VERSION file + - name: Get tag from package.json id: get_tag run: | VERSION=$(npm run version --silent) - echo "tag=v${VERSION}" >> $GITHUB_OUTPUT + echo "tagname=v${VERSION}" >> $GITHUB_OUTPUT + + - uses: rickstaa/action-create-tag@v1 + with: + tag: ${{ steps.get_tag.outputs.tagname }} build-images: if: github.repository == 'runtipi/runtipi' - needs: get-tag + needs: create-tag runs-on: ubuntu-latest steps: - name: Checkout @@ -49,14 +49,45 @@ jobs: context: . platforms: linux/amd64,linux/arm64 push: true - tags: ghcr.io/${{ github.repository_owner }}/runtipi:${{ needs.get-tag.outputs.tag }},ghcr.io/${{ github.repository_owner }}/runtipi:latest + tags: ghcr.io/${{ github.repository_owner }}/runtipi:${{ needs.create-tag.outputs.tagname }},ghcr.io/${{ github.repository_owner }}/runtipi:latest cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/runtipi:buildcache cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/runtipi:buildcache,mode=max + build-worker: + runs-on: ubuntu-latest + needs: create-tag + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push images + uses: docker/build-push-action@v5 + with: + context: . + file: ./packages/worker/Dockerfile + platforms: linux/amd64,linux/arm64 + push: true + tags: ghcr.io/${{ github.repository_owner }}/worker:${{ needs.create-tag.outputs.tagname }},ghcr.io/${{ github.repository_owner }}/worker:latest + cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/worker:buildcache + cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/worker:buildcache,mode=max + build-cli: runs-on: ubuntu-latest timeout-minutes: 10 - needs: get-tag + needs: create-tag steps: - name: Checkout code uses: actions/checkout@v4 @@ -90,7 +121,7 @@ jobs: run: pnpm install - name: Set version - run: pnpm -r --filter cli set-version ${{ needs.get-tag.outputs.tag }} + run: pnpm -r --filter cli set-version ${{ needs.create-tag.outputs.tagname }} - name: Build CLI run: pnpm -r --filter cli package @@ -101,22 +132,6 @@ jobs: name: cli path: packages/cli/dist - create-tag: - runs-on: ubuntu-latest - needs: [build-images, build-cli] - outputs: - tagname: ${{ steps.create_tag.outputs.tagname }} - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Create Tag - id: create_tag - uses: Klemensas/action-autotag@stable - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - tag_prefix: 'v' - publish-release: runs-on: ubuntu-latest needs: [create-tag] @@ -129,38 +144,26 @@ jobs: name: cli path: cli + - name: Rename CLI + run: | + mv cli/bin/cli-x64 ./runtipi-cli-linux-x64 + mv cli/bin/cli-arm64 ./runtipi-cli-linux-arm64 + - name: Create release id: create_release - uses: actions/create-release@v1 + uses: softprops/action-gh-release@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: body: | **${{ needs.create-tag.outputs.tagname }}** tag_name: ${{ needs.create-tag.outputs.tagname }} - release_name: ${{ needs.create-tag.outputs.tagname }} + name: ${{ needs.create-tag.outputs.tagname }} draft: false prerelease: true - - - name: Upload X64 Linux CLI binary to release - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: cli/bin/cli-x64 - asset_name: runtipi-cli-linux-x64 - asset_content_type: application/octet-stream - - - name: Upload ARM64 Linux CLI binary to release - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: cli/bin/cli-arm64 - asset_name: runtipi-cli-linux-arm64 - asset_content_type: application/octet-stream + files: | + runtipi-cli-linux-x64 + runtipi-cli-linux-arm64 e2e-tests: needs: [create-tag, publish-release]