diff --git a/.github/workflows/release-debian.yml b/.github/workflows/release-debian.yml index 129b0a428..edbca7aec 100644 --- a/.github/workflows/release-debian.yml +++ b/.github/workflows/release-debian.yml @@ -1,4 +1,4 @@ -name: Release - Debian +name: Release on: workflow_dispatch: @@ -9,9 +9,8 @@ on: default: "next" jobs: - tagged-release: - runs-on: ubuntu-latest - container: debian:12 + build-release: + runs-on: ubuntu-20.04 env: MIX_ENV: prod @@ -19,59 +18,57 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Add Debian 11 repository and install OpenSSL 1.1 + - name: Set TAG and VERSION + id: vars run: | - echo "deb http://deb.debian.org/debian bullseye main" | tee -a /etc/apt/sources.list.d/bullseye.list - apt update - apt install -y libssl1.1 - rm /etc/apt/sources.list.d/bullseye.list - apt update + TAG="${{ inputs.bundle }}_$(date +%F)_${{ github.run_number }}" + echo "TAG=$TAG" >> $GITHUB_ENV + echo "VERSION=$TAG" >> $GITHUB_ENV + shell: bash - - name: Install Node.js - run: | - apt-get update - apt-get install -y curl git build-essential - curl -fsSL https://deb.nodesource.com/setup_18.x | bash - - apt-get install -y nodejs - - - name: Tag name - id: tag - run: echo "TAG=${{ github.event.inputs.bundle }}_$(date +%F)_${{ github.run_number }}" >> $GITHUB_ENV + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - - id: setup-elixir - uses: erlef/setup-elixir@v1 + - name: Build Docker Image with cache + uses: docker/build-push-action@v5 with: - otp-version: "25.3.2.7" - elixir-version: "1.14.0" + context: . + file: ./Dockerfile + tags: next-platform:latest + push: false + load: true + cache-from: type=gha + cache-to: type=gha,mode=max - - name: Setup the Elixir project + - name: Run build inside Docker run: | - mix deps.get - working-directory: core + docker run --rm \ + -e MIX_ENV=$MIX_ENV \ + -e BUNDLE=${{ inputs.bundle }} \ + -e VERSION=$VERSION \ + -v ${{ github.workspace }}:/app \ + next-platform:latest \ + bash -c "cd /app/core && mix deps.get && ./scripts/build-frontend && ./scripts/build-release" - - name: Build Frontend - run: | - ./scripts/build-frontend + - name: Archive release working-directory: core - - - name: Build release run: | - ./scripts/build-release - working-directory: core - env: - BUNDLE: ${{ github.event.inputs.bundle }} - VERSION: ${{ env.TAG }} + tar cfj "${VERSION}.tar.bz2" "${VERSION}" - - name: Archive release - run: | - tar cfj "../${{ env.TAG }}.tar.bz2" "${{ env.TAG }}" - working-directory: core + - name: Verify artifact + run: ls -l core/*.tar.bz2 + + # - name: Create GitHub Release + # uses: softprops/action-gh-release@v2 + # with: + # tag_name: ${{ env.VERSION }} + # prerelease: false + # fail_on_unmatched_files: true + # files: | + # core/${{ env.VERSION }}.tar.bz2 - - name: Publish Release - uses: softprops/action-gh-release@v2 + - name: Upload release artifact + uses: actions/upload-artifact@v3 with: - tag_name: "${{ env.TAG }}" - prerelease: false - fail_on_unmatched_files: true - files: | - ${{ env.TAG }}.tar.bz2 + name: release-artifact + path: core/${{ env.VERSION }}.tar.bz2 diff --git a/Dockerfile b/Dockerfile index afdc82fb4..06dbc69f7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,7 +26,7 @@ RUN git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.10.2 \ && echo '. $HOME/.asdf/asdf.sh' >> ~/.bashrc \ && echo '. $HOME/.asdf/completions/asdf.bash' >> ~/.bashrc -RUN echo "export PATH=\"$HOME/.asdf/bin:$HOME/.asdf/shims:$PATH\"" >> ~/.bashrc +ENV PATH="/root/.asdf/bin:/root/.asdf/shims:${PATH}" RUN bash -c "source ~/.bashrc && \ asdf plugin-add erlang https://github.com/asdf-vm/asdf-erlang.git && \