ci: added publish jobs
diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml
index d62bc1e..9931885 100644
--- a/.github/workflows/integration.yml
+++ b/.github/workflows/integration.yml
@@ -32,12 +32,6 @@
molecule:
runs-on: ubuntu-latest
steps:
- - name: Install QEMU static binaries
- uses: docker/setup-qemu-action@v2
-
- - name: Configure Buildkit
- uses: docker/setup-buildx-action@v2
-
- name: Checkout project
uses: actions/checkout@v3.0.2
@@ -47,24 +41,6 @@
go-version-file: go.mod
cache: true
- - name: Authenticate with Quay.io
- uses: docker/login-action@v2
- if: ${{ github.event_name == 'push' }}
- with:
- registry: quay.io
- username: ${{ secrets.QUAY_USERNAME }}
- password: ${{ secrets.QUAY_ROBOT_TOKEN }}
-
- - name: Build image
- uses: docker/build-push-action@v3
- with:
- cache-from: type=gha
- cache-to: type=gha,mode=max
- context: .
- platforms: linux/amd64
- push: ${{ github.event_name == 'push' }}
- tags: quay.io/vexxhost/atmosphere:${{ github.sha }}
-
- name: Clean-up stale stacks
run: go run ./cmd/atmosphere-ci molecule cleanup
env:
@@ -87,10 +63,3 @@
OS_PASSWORD: ${{ secrets.OS_PASSWORD }}
OS_PROJECT_DOMAIN_NAME: Default
OS_PROJECT_NAME: ${{ secrets.OS_PROJECT_NAME }}
-
- - name: Promote image
- uses: akhilerm/tag-push-action@v2.0.0
- if: github.ref == 'refs/heads/main'
- with:
- src: quay.io/vexxhost/atmosphere:${{ github.sha }}
- dst: quay.io/vexxhost/atmosphere:latest
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
new file mode 100644
index 0000000..aadfe03
--- /dev/null
+++ b/.github/workflows/publish.yml
@@ -0,0 +1,73 @@
+name: publish
+
+on:
+ release:
+ types:
+ - published
+
+jobs:
+ ansible-collection:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout project
+ uses: actions/checkout@v3.0.2
+
+ - name: Build and publish collection
+ uses: artis3n/ansible_galaxy_collection@v2
+ with:
+ api_key: "${{ secrets.GALAXY_API_KEY }}"
+
+ - name: Get release
+ uses: bruceadams/get-release@v1.2.2
+ id: get_release
+ env:
+ GITHUB_TOKEN: ${{ github.token }}
+
+ - name: Get file name for collection
+ id: get_filename
+ run: echo ::set-output name=filename::$(ls *.tar.gz)
+
+ - name: Upload release asset
+ uses: actions/upload-release-asset@v1.0.2
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ with:
+ upload_url: ${{ steps.get_release.outputs.upload_url }}
+ asset_path: ./${{ steps.get_filename.outputs.filename }}
+ asset_name: ${{ steps.get_filename.outputs.filename }}
+ asset_content_type: application/gzip
+
+ image:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Install QEMU static binaries
+ uses: docker/setup-qemu-action@v2.0.0
+
+ - name: Configure Buildkit
+ uses: docker/setup-buildx-action@v2.0.0
+
+ - name: Checkout project
+ uses: actions/checkout@v3.0.2
+
+ - name: Authenticate with Quay.io
+ uses: docker/login-action@v2.0.0
+ with:
+ registry: quay.io
+ username: ${{ secrets.QUAY_USERNAME }}
+ password: ${{ secrets.QUAY_ROBOT_TOKEN }}
+
+ - name: Generate image tag
+ id: image_tag
+ run: |
+ echo ::set-output name=tag::$(echo ${{ github.event.release.tag_name }} | sed 's/^v//')
+
+ - name: Build image
+ uses: docker/build-push-action@v3.1.1
+ with:
+ context: .
+ cache-from: type=gha
+ cache-to: type=gha,mode=max
+ push: true
+ tags: |
+ quay.io/vexxhost/atmosphere:latest
+ quay.io/vexxhost/atmosphere:${{ steps.image_tag.outputs.tag }}