Skip to content

Add RPM installation #179

Add RPM installation

Add RPM installation #179

Workflow file for this run

name: CI
on:
push:
tags-ignore:
- "*"
branches:
- "main"
pull_request:
release:
types: [published]
workflow_dispatch:
jobs:
ansible-lint:
name: Playbook linting
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Run ansible-lint
uses: ansible/ansible-lint-action@v6
build-and-push-container-images:
name: Build and push container images
runs-on: ubuntu-latest
if: github.event_name == 'release' || (github.event_name == 'push' && github.ref_name == 'main')
needs: [ansible-lint]
permissions:
contents: read
packages: write
env:
REGISTRY: ghcr.io
IMAGE_REPOSITORY: ghcr.io/${{ github.repository_owner }}/ansible
IMAGE_TAG: "${{ (github.event_name == 'release' && github.event.release.tag_name) || (github.event_name == 'push' && github.ref_name == 'main' && 'rolling') || github.sha }}"
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: docker/setup-buildx-action@v2
- name: Log in to the Container registry
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@507c2f2dc502c992ad446e3d7a5dfbe311567a96
with:
images: ${{ env.IMAGE_REPOSITORY }}
- name: Build and push container image
uses: docker/build-push-action@v4
with:
context: .
file: "docker/Dockerfile"
push: true
tags: ${{ env.IMAGE_REPOSITORY }}:${{ env.IMAGE_TAG }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
create-artifact:
runs-on: ubuntu-20.04
needs: [ansible-lint]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Compress tarball
run: |
tar -zcf trento-ansible.tgz roles/ playbook.yml playbook.cleanup.yml requirements.yml README.md
- uses: actions/upload-artifact@v3
with:
name: trento-ansible
path: |
*.tgz
release-rolling:
runs-on: ubuntu-20.04
if: (github.event_name == 'push' && github.ref == 'refs/heads/main')
needs: [create-artifact]
steps:
- uses: actions/download-artifact@v3
with:
name: trento-ansible
- uses: "marvinpinto/[email protected]"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "rolling"
prerelease: true
title: "Cutting Edge"
files: |
trento-ansible.tgz
release:
runs-on: ubuntu-20.04
if: github.event.release
needs: [create-artifact]
steps:
- uses: actions/download-artifact@v3
with:
name: trento-ansible
- uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: trento-ansible.tgz
tag: ${{ github.ref }}