name: CI on: push: branches: - "main" tags: - 'v*.*.*' pull_request: branches: - "main" jobs: pretest: name: Test (with Dockerfile) runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Update action.yml to build locally run: | sed -i 's/.*image\:.*/ image\: \"Dockerfile\"/' action.yml cat action.yml - name: Get sample package run: | mkdir visual-studio-code-bin pushd visual-studio-code-bin wget https://github.com/dcelasun/pkgbuilds/raw/ee68e4c19c40a0a36a50e289259fcfd94f43786d/visual-studio-code-bin/PKGBUILD wget https://github.com/dcelasun/pkgbuilds/raw/ee68e4c19c40a0a36a50e289259fcfd94f43786d/visual-studio-code-bin/.SRCINFO wget https://github.com/dcelasun/pkgbuilds/raw/ee68e4c19c40a0a36a50e289259fcfd94f43786d/visual-studio-code-bin/visual-studio-code-bin.install wget https://github.com/dcelasun/pkgbuilds/raw/ee68e4c19c40a0a36a50e289259fcfd94f43786d/visual-studio-code-bin/visual-studio-code-bin.sh popd - name: Running test uses: ./ with: pkgver: '1.100.1' pkgrel: 1 updpkgsums: true srcinfo: true path: 'visual-studio-code-bin' - name: Show diff run: | ls -la git diff publish: name: Publish OCI image needs: pretest if: github.event_name != 'pull_request' runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Log in to ghcr.io uses: redhat-actions/podman-login@v1 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: OCI metadata id: metadata uses: docker/metadata-action@v5 with: images: ghcr.io/${{ github.repository }} tags: | type=edge,branch=main type=ref,event=branch type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} type=semver,pattern={{major}} type=sha - name: Build image id: build uses: redhat-actions/buildah-build@v2 with: tags: ${{ steps.metadata.outputs.tags }} labels: ${{ steps.metadata.outputs.labels }} containerfiles: | ./Dockerfile extra-args: | --pull - name: Push to ghcr.io uses: redhat-actions/push-to-registry@v2 with: image: ${{ steps.build.outputs.image }} tags: ${{ steps.build.outputs.tags }} registry: ghcr.io extra-args: | --disable-content-trust test: name: Test (with prebuilt OCI Image) needs: publish runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Get sample PKGBUILD run: wget https://github.com/${{ github.repository_owner }}/plenti-bin/raw/f5ffaaee02a2119aa16f6b7a27e87e198e096b47/PKGBUILD - name: Update action.yml to use edge tagged container image if: github.ref == 'refs/heads/main' run: | REPOSITORY_OWNER=${{ github.repository_owner }} REPOSITORY_OWNER=$(echo $REPOSITORY_OWNER | tr '[:upper:]' '[:lower:]') REPOSITORY_NAME=${{ github.event.repository.name }} REPOSITORY_NAME=$(echo $REPOSITORY_NAME | tr '[:upper:]' '[:lower:]') sed -i "s/.*image\:.*/ image\: \"docker\:\/\/ghcr.io\/${REPOSITORY_OWNER}\/${REPOSITORY_NAME}\:edge\"/" action.yml cat action.yml - name: Running test uses: ./ with: pkgver: '0.4.26' pkgrel: 2 updpkgsums: true srcinfo: true - name: Show diff run: | ls -la git diff release: name: Release runs-on: ubuntu-latest needs: test if: startsWith(github.ref, 'refs/tags/v') steps: - name: Checkout uses: actions/checkout@v4 - name: Get branch/tag names id: branch-name uses: tj-actions/branch-names@v8 with: strip_tag_prefix: "v" - name: Read changelog id: changelog-reader uses: mindsers/changelog-reader-action@v2 with: version: ${{ steps.branch-name.outputs.tag }} path: ./CHANGELOG.md - name: Create/update release uses: ncipollo/release-action@v1 with: tag: v${{ steps.branch-name.outputs.tag }} name: v${{ steps.branch-name.outputs.tag }} body: ${{ steps.changelog-reader.outputs.changes }} allowUpdates: true token: ${{ secrets.GITHUB_TOKEN }}