1
Fork 0
mirror of https://github.com/Steffo99/patched-porobot.git synced 2024-10-16 17:47:29 +00:00

Update GitHub Actions workflows

This commit is contained in:
Steffo 2022-12-24 03:55:52 +01:00
parent f908f3b5ed
commit b52e23b882
Signed by: steffo
GPG key ID: 6965406171929D01
4 changed files with 60 additions and 85 deletions

View file

@ -1,53 +0,0 @@
name: "Automated release"
on:
push:
tags:
- "v*"
jobs:
publish-docker:
name: "🐳 Build and publish Docker image on ghcr.io"
runs-on: ubuntu-latest
steps:
- name: "Checkout repository"
uses: actions/checkout@v2
- name: "❓ Find the release semantic version"
id: semver
uses: Steffo99/actions-semver@v0.3.4
with:
string: ${{ github.ref_name }}
- name: "🔨 Setup Buildx"
uses: docker/setup-buildx-action@v2
- name: "🔑 Login to GitHub Containers"
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: "🔽 Find the lowercase name of the repository"
id: reponame
uses: ASzc/change-string-case-action@v2
with:
string: ${{ github.repository }}
- name: "🏗 Build and push the Docker image"
uses: docker/build-push-action@v3
with:
tags: >-
ghcr.io/${{ steps.reponame.outputs.lowercase }}:${{ steps.semver.outputs.precedence }},
ghcr.io/${{ steps.reponame.outputs.lowercase }}:${{ steps.semver.outputs.core }},
ghcr.io/${{ steps.reponame.outputs.lowercase }}:${{ steps.semver.outputs.pair }},
ghcr.io/${{ steps.reponame.outputs.lowercase }}:${{ steps.semver.outputs.major }},
ghcr.io/${{ steps.reponame.outputs.lowercase }}:latest
push: true
- name: "🌐 Create release"
uses: ncipollo/release-action@v1.10.0
with:
draft: true
generateReleaseNotes: true

23
.github/workflows/release.yml vendored Normal file
View file

@ -0,0 +1,23 @@
name: "Release new version"
on:
# Creation of a new tag starting with v
push:
tags:
- "v*"
jobs:
test:
uses: ./.github/workflows/test.yml
ghcrio:
uses: Steffo99/.github/.github/workflows/buildrelease-docker.yml@main
needs:
- test
portainer:
uses: Steffo99/.github/.github/workflows/deploy-portainer.yml@main
needs:
- ghcrio
secrets:
PORTAINER_HOOK_URL: ${{ secrets.PORTAINER_HOOK_URL }}

37
.github/workflows/test.yml vendored Normal file
View file

@ -0,0 +1,37 @@
name: "Test suite"
on:
# Modification of a project file in the main branch
push:
branches:
- main
paths:
- "src/**"
- "tests/**"
- "benches/**"
- "examples/**"
- "Cargo.toml"
- "Cargo.lock"
# Pull request to the main branch modifying a project file
pull_request:
branches:
- main
paths:
- "src/**"
- "tests/**"
- "benches/**"
- "examples/**"
- "Cargo.toml"
- "Cargo.lock"
# Triggered by a new release
workflow_call:
env:
CARGO_TERM_COLOR: always
jobs:
clippy:
uses: Steffo99/.github/.github/workflows/test-cargo-clippy.yml@main
test:
uses: Steffo99/.github/.github/workflows/test-cargo-test.yml@main

View file

@ -1,32 +0,0 @@
name: "Continuous integration"
on:
pull_request:
branches:
- main
workflow_call:
jobs:
cargotest:
name: "Run checks and tests on the repository"
runs-on: ubuntu-latest
steps:
- name: "Checkout repository"
uses: actions/checkout@v3
- name: "Install Rust toolchain"
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: "Run cargo clippy"
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features
- name: "Run cargo test"
uses: actions-rs/cargo@v1
with:
command: test