diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..e176169 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,66 @@ +--- +on: + push: + branches: + - "*" + tags: + - "v*.*.*" + +jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.12' + + - name: Setup + run: make setup + + - uses: pre-commit/action@v3.0.1 + env: + SKIP: "no-commit-to-branch" + + molecule: + runs-on: ubuntu-latest + env: + ANSIBLE_FORCE_COLOR: true + steps: + - name: Checkout + uses: actions/checkout@v2 + + - uses: actions/setup-python@v5 + with: + python-version: '3.12' + + - name: Setup + run: make setup + + - name: Molecule + run: | + molecule --debug test --scenario-name default + + semantic-release: + runs-on: ubuntu-latest + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + needs: + - pre-commit + - molecule + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Generate a token + id: generate_token + uses: actions/create-github-app-token@v1 + with: + app-id: ${{ secrets.CICD_APP_ID }} + private-key: ${{ secrets.CICD_APP_PRIVATE_KEY }} + + - name: Semantic Release + uses: cycjimmy/semantic-release-action@v3 + env: + GITHUB_TOKEN: "${{ steps.generate_token.outputs.token }}" diff --git a/.github/workflows/molecule.yml b/.github/workflows/molecule.yml deleted file mode 100644 index ba6ea42..0000000 --- a/.github/workflows/molecule.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Molecule - -on: - pull_request: {} - -jobs: - molecule: - runs-on: ubuntu-latest - env: - ANSIBLE_FORCE_COLOR: true - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Setup python - uses: actions/setup-python@v3 - - name: setup - run: make setup - - name: Molecule - run: | - molecule --debug test --scenario-name default diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml deleted file mode 100644 index 5661d67..0000000 --- a/.github/workflows/pre-commit.yml +++ /dev/null @@ -1,19 +0,0 @@ ---- -on: - push: {} - -jobs: - pre-commit: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v3 - - name: setup - run: make setup - - name: Set skips on ci run - run: | - if [[ $GITHUB_REF_PROTECTED =~ "true" ]]; then - echo "SKIP=no-commit-to-branch" >> $GITHUB_ENV - fi - - name: run pre-commit - run: pre-commit run --show-diff-on-failure --all-files diff --git a/.github/workflows/semantic-release.yml b/.github/workflows/semantic-release.yml deleted file mode 100644 index 519e7fc..0000000 --- a/.github/workflows/semantic-release.yml +++ /dev/null @@ -1,11 +0,0 @@ ---- -on: - push: - branches: - - main - -jobs: - semantic-release: - uses: rwxd/gh-templates/.github/workflows/common-semantic-release.yml@main - secrets: - token: ${{ secrets.GITHUB_TOKEN }}