diff --git a/.gitlab/CODEOWNERS b/.github/CODEOWNERS similarity index 100% rename from .gitlab/CODEOWNERS rename to .github/CODEOWNERS diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..c710ece --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,34 @@ +name: Earthly +build + +on: + merge_group: + pull_request: + push: + branches: + - main + +env: + FORCE_COLOR: 1 + +jobs: + build: + timeout-minutes: 30 + runs-on: ubuntu-latest + + steps: + - uses: earthly/actions-setup@v1 + with: + use-cache: true + version: v0.8.0 + + # Pulling rust toolchain & install linux dependencies + - uses: dtolnay/rust-toolchain@stable + + # Setup repo and add caching + - uses: actions/checkout@v4 + + - name: Docker Login + run: docker login ghcr.io -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} + + - name: Run build + run: earthly --push --ci -P +all diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..e5c4c3c --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,46 @@ +name: Open a release PR + +# how to trigger: https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow +on: + workflow_dispatch: + inputs: + version: + description: Version to release + required: true + type: string + +env: + CARGO_TERM_COLOR: always + +jobs: + release-pr: + runs-on: ubuntu-latest + permissions: + id-token: write # Enable OIDC + contents: write + pull-requests: write + + steps: + - uses: actions/checkout@v4 + - uses: actions/cache@v4 + with: + path: | + target/ + ~/.cargo/bin/ + ~/.cargo/git/db/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + key: ${{ runner.os }}-cargo-build-stable-${{ hashFiles('**/Cargo.toml') }} + + - uses: chainguard-dev/actions/setup-gitsign@main + + # Pulling rust toolchain & install linux dependencies + - uses: dtolnay/rust-toolchain@stable + + - name: Install cargo-release + uses: taiki-e/install-action@v1 + with: + tool: cargo-smart-release + + - name: Release + run: cargo smart-release -ue diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml new file mode 100644 index 0000000..44f720c --- /dev/null +++ b/.github/workflows/tag.yml @@ -0,0 +1,53 @@ +name: Earthly +tag + +on: + push: + tags: + - "v*.*.*" + +env: + FORCE_COLOR: 1 + +jobs: + tag: + timeout-minutes: 60 + runs-on: ubuntu-latest + + steps: + # Setup repo and add caching + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + fetch-tags: true + + #Deps + - name: Set up Earthly + uses: earthly/actions-setup@v1 + with: + version: v0.8.0 + use-cache: true + + - name: Set up Python + uses: actions/setup-python@v5 + - name: Add tomlq + run: pip install tomlq + + - name: Docker Login + run: docker login ghcr.io -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} + + - name: Fetch tags + run: git fetch --tags + + - name: Get Latest Tag + id: latest_tag + run: echo "LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)" >> $GITHUB_OUTPUT + + - name: Check Cargo Version + id: cargo_version + run: echo "CARGO_PACKAGE_VERSION=$(tomlq '.package.version' $PWD/Cargo.toml | sed 's/\"//g')" >> $GITHUB_OUTPUT + + - name: Run build + env: + TAG: ${{ steps.latest_tag.outputs.LATEST_TAG }} + LATEST: ${{ steps.cargo_version.outputs.CARGO_PACKAGE_VERSION == steps.latest_tag.outputs.LATEST_TAG }} + run: earthly --push --ci -P +all --TAG=${{ env.TAG }} --LATEST=${{ env.LATEST }} diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 0b340e7..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,6 +0,0 @@ -variables: - INTEGRATION_TESTS: 1 - -include: - - project: wunker-bunker/ci-pipelines - file: cargo-earthly.yml diff --git a/Earthfile b/Earthfile index 9d97f32..b4d32e9 100644 --- a/Earthfile +++ b/Earthfile @@ -1,12 +1,8 @@ -VERSION \ - --global-cache \ - --use-function-keyword \ - --arg-scope-and-set \ - 0.7 +VERSION 0.8 -IMPORT gitlab.com/wunker-bunker/ci-pipelines/earthly/cargo AS cargo +IMPORT github.com/blue-build/earthly-lib/cargo AS cargo -ARG --global IMAGE=registry.gitlab.com/wunker-bunker/blue-build +ARG --global IMAGE=ghcr.io/blue-build/cli all: BUILD +default